Question

I have created a batch(batA) file that kicks off another batch(marathon.bat) file. When I save batA onto my desktop and use

start /wait ..\marathon\marathon.bat -batch "C:\stuff"

it works just fine. However, when I save marathon.bat to my program files, which now has spaces in the name, and then use

start /wait c:\"Program Files (x86)\marathon\marathon.bat" -batch "c:\stuff"

I get the error:

'c:\Program' is not recognized as an internal or external command, operable program or batch file.

I know that you have to use double quotes so that it takes the spaces into consideration, but why is it stopping at c:\Program? I've tried moving the quotes around to different locations, but I can't seem to get it to recognize the second file.

Was it helpful?

Solution

Does this work for you?

 start "" /wait %comspec% /c "c:\Program Files (x86)\marathon\marathon.bat" -batch "c:\stuff"

OTHER TIPS

You have 2 problems with how you call your batch file.

First, you have placed your quotes at the wrong place. Instead of

start /wait c:\"Program Files (x86)\marathon\marathon.bat" 

You should enclose your whole command with quotes, not only from the Program Files folder name:

start /wait "c:\Program Files (x86)\marathon\marathon.bat" 

The second problem is that the first parameter with quotes specified to the START command is treated as the title of the new window. You should add an empty set of quotes before your command to circumvent this:

start "" /wait "c:\Program Files (x86)\marathon\marathon.bat" 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top