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".

Member Avatar for onaclov2000

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?

Member Avatar for onaclov2000

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.