So I'm trying to run a command using OS.execute
(CMD) which will write the output of a command to a file. i.e:
var commandString = str("g++ -g ", fileString, " -o ", execString, " 1> ", outString, " 2>&1")
OS.execute("CMD.exe", ["/C", commandString], true, output1)
However, when I try to do this I get the follow error from the CMD:
The system cannot find the path specified.
Despite the fact when commandString
is printed to console and copied, g++
runs fine.
I went to the official documentation looking for answers and the 3rd code snippet they display:
OS.execute("CMD.exe", ["/C", "cd %TEMP% && dir"], true, output)
Returns this error from CMD:
The filename, directory name, or volume label syntax is incorrect.
Despite cd %TEMP% && dir
working fine when I run it manually.
Am I doing something wrong or is something else going on here?