开发者

How to pass arguments into variables to eventually execute in a batch file?

I'm looking to create an App file wrapper that will take 3 arguments with an optional 4th argument. The 1st argument will be the location of a directory that needs "work" done, the 2nd and 3rd arguments should be appended together as one argument to run an application, and the 4th argument will be a switch.

Ex: AppFileWrapper C:\Application\ App begin-work -New

1st argument: C:\Application

2nd argument: App

3rd argument: begin-work

4th开发者_Go百科 argument (optional): -New

What I need is a batch file that will automatically navigate to the given directory, and then execute the remaining arguments as: "App begin-work -New"

I've created the following batch file

cd %1
set var1=%2 %3 %4

Now how to just call var1 or "App begin-work -New" or "App begin-work" as specified by the parameters.

Thanks, I'm completely new to creating batch files.


cd %1
start %2 %3 %4

should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜