0

How does one make a batch file that can pass arguments to another command?

For instance say I ran "c:\files\run.bat -a -b", this would call "c:\folders\do.exe -a -b".

3
Contributors
3
Replies
5
Views
8 Years
Discussion Span
Last Post by onaclov2000
0

Have you tried just running
call c:\folders\do.exe -a -b

It should be as simple as that...now if -a and -b are files, you really need to pass the entire location in, because if you call from a different location as the above file, and those -a and -b files reside in c:\folders, and you're in c:\ it won't find them unless you explicitly pass in the path.

Are you having problems? Have you tried this?

0

couple ways to do it, I would say if you're testing you'd want to open a command prompt and then type in the name of the batch file, then a space then the first parameter, then a space then the second parameter. The other option is to create a batch file, that calls the second batch file and again you would just write:
batch1 -a -b

and that should run your file.

If you feel comfortable using the command line I wrote up a how to to get a command prompt in the folder you're in using the right click context menu:
My Blog

Edit: wow I feel a little retarded, I thought the second post was the initial poster, so I tried answering that......never mind this post

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.