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


this command works

start /b /wait "dummy title" "c:\tmp\test runner2.bat" arg1 arg2 

but both of these fails!

start /b /wait "dummy title" "c:\tmp\test runner2.bat" arg1 arg2 "arg 3" arg4 start /b /wait "dummy title" "c:\tmp\test runner2.bat" arg1 arg2 "arg 3" 

the error is:

'c:\tmp\test' not recognized internal or external command, operable program or batch file. 

obviously has " surounding arguments, why , how work around this?

related questions:

it's known bug of start command.
if have spaces in both, command , of parameters , try handle them quotes, fails.

first start command check if full command exists.
starts first part.

in case looks "c:\tmp\test runner2.bat" try start c:\tmp\test.

you can avoid when command replaced call

start /b /wait "dummy title" call "c:\tmp\test runner2.bat" arg1 arg2 "arg 3" arg4 

the start uses cmd /k start new process.
, cause misbehaviour.
paul groke mentioned fact, occours when it's batch file.
exe files executed directly , not affected cmd.exe bug.

in case

c:\windows\system32\cmd.exe  /k "c:\tmp\test runner2.bat" arg1 arg2 "arg 3" arg4 

and of cmd /k , cmd /c explains, in case first , last quote removed.


Comments