Why does windows START command not work with spaces in arguments AND path? Why does windows START command not work with spaces in arguments AND path? windows windows

Why does windows START command not work with spaces in arguments AND path?


It's a known bug of the START command.
If you have spaces in both, the command and of the parameters and try to handle them with quotes, it fails.

First the START command check if the full command exists.
But then it starts only the first part.

In your case it looks for "C:\tmp\test runner2.bat" but try to start C:\tmp\test.

You can avoid it when the command is replaced by a CALL

START /b /wait "Dummy title" CALL "C:\tmp\test runner2.bat" arg1 arg2 "arg 3" arg4

The START uses cmd /k to start the new process.
And that is the cause for the misbehaviour.
Paul Groke mentioned the fact, that this only occours when it's a batch file.
Exe files will be executed directly and so they are not affected by the cmd.exe bug.

In your case

C:\Windows\system32\cmd.exe  /K "C:\tmp\test runner2.bat" arg1 arg2 "arg 3" arg4

And the help of cmd /k and cmd /c explains, that in this case the first and last quote are removed.


"Jeb" already pointed into the right direction. In my case i didn't tried to run a batch, but a program in the "Program Files" folder (batch shall terminate after launching the program). When calling

START "C:\Program Files\MyAppPath\MyApp.exe" arg1 arg2 ... argN

the path typed with quotes around is supposed to be the "Title" parameter by START command. To get rid of that, you have to "fake" a window title like that:

START "" "C:\Program Files\MyAppPath\MyApp.exe" arg1 arg2 ... argN

This helped in my case.


This does not answer my question, but it does solve the immediate problem I'm having.

While reading through the "Problem with quotes around file names in Windows command shell"-post I discovered a workaround:

cmd.exe /C ""C:\tmp\test runner2.bat" arg1 arg2 "arg 3" arg4"

There is also the other workaround by simply executing the command with the call command instead (as stated by Ansgar Wiechers)

call "C:\tmp\test runner2.bat" arg1 arg2 "arg 3" arg4