I'm trying to start a process from cmd and return it's PID (process id).
The command works, but there is something wrong with the escaping because some command arguments make it fail.
The command i'm trying to run is this one:
start /B wmic process call create "\"d:\software\winnmp\bin\PHP\php-7.1.12/php.exe\" \"D:\projects\php\masked/artisan\" queue:work --queue=high,default,low" | find "ProcessId"
This will return "Invalid Verb Switch."
I narrowed it down to the comma sign in the high,default,low argument because if i run this one, it works as expected:
start /B wmic process call create "\"d:\software\winnmp\bin\PHP\php-7.1.12/php.exe\" \"D:\projects\php\masked/artisan\" queue:work --queue=high" | find "ProcessId"
Returns: "ProcessId = 1234"
I got the impression wmic is trying to interpret the --queue=high,default,low
argument, so i guess it's not properly escaped. I also tried to wrap everything after the start /B in quotes, but i can't figure out how to do it. I tried escaping double quotes with "" and ^" and \" and with inner escpaced backslashes i tried \.
All paths do need to be in quotes because i don't know if they are going to contain spaces or not.