C # Process.Start: spaces don't work even in quotes
What I got:
Process.Start("cmd.exe", "/K \"C:/Program Files/nodejs/node.exe\" \"C:/rc/rainingchain/app.js\"");
Even though I wrapped the filename with the escaped ", it still displays the error:
'C:/Program' is not recognized as an internal or external command, operable program or batch file.
What's wrong?
source to share
Your code will be translated to
cmd.exe /K "C:/Program Files/nodejs/node.exe" "C:/rc/rainingchain/app.js"
cmd.exe will translate it to
C:/Program Files/nodejs/node.exe" "C:/rc/rainingchain/app.js
This is why he complains about mistakes.
You will need to wrap the whole node.exe command with a double quote again.
Process.Start("cmd.exe", "/K \"\"C:/Program Files/nodejs/node.exe\" \"C:/rc/rainingchain/app.js\"\"");
so the node.exe command would be "C:/Program Files/nodejs/node.exe" "C:/rc/rainingchain/app.js"
By the way, why not just call node.exe directly?
Process.Start("C:/Program Files/nodejs/node.exe", "C:/rc/rainingchain/app.js");
source to share