Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Process.Start: Whitespace Not Working Even Quoted

Tags:

c#

cmd

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 escaped ", it still displays the error:

'C:/Program' is not recognized as an internal or external command, operable program or batch file.

What is wrong?

like image 348
RainingChain Avatar asked Dec 26 '22 02:12

RainingChain


1 Answers

You need to use two " for spaces in program path:

Process.Start("cmd.exe", "/K \"\"C:/Program Files/nodejs/node.exe\" \"C:/rc/rainingchain/app.js\"\"");
like image 69
Aleksey Shubin Avatar answered Jan 05 '23 13:01

Aleksey Shubin