Let's say I have a batch file C:\MyFile.bat
as follows:
echo This is my batch file
pause
I invoke it like this, because I need a new console window to open:
start /wait C:\MyFile.bat
I get the expected result... a new console window opens, displays the echo and waits on the pause.
However, if I instead name the batch file C:\My File.bat
(space in the file's name), I must now enclose the filename in doublequotes, as follows:
start /wait "C:\My File.bat"
However doing so does not result as expected. A new console window is opened, but the specified batch file does not execute.
start
considers the first set of quotes that it finds to be the title of the new window.
To get around this, add a throwaway set of quotes to the command:
start "" /wait "C:\My File.bat"