Problem with escaping commands in spawProcess().

Cooler kulkin at hotbox.ru
Fri Mar 7 01:26:26 PST 2014


import std.process;

int main(string[]){
   // Next line will generate error message from cmd.exe
   spawnProcess(["cmd.exe", "/C", "echo"]).wait();
   return 0;
}

Running the code above will result in windows shell error 
message. As I understand the error is due to escaping all 
arguments in std.process.spawnProcess function.

int main(string[]){
   spawnShell("cmd.exe /C echo").wait(); // Works fine
   return 0;
}

Is there any way to run the code with spawnProcess instead of 
spawnShell?


More information about the Digitalmars-d-learn mailing list