Skip navigation
Currently Being Moderated

NativeProcess fails if args contain spaces

Jun 6, 2011 7:51 AM

Following code works just fine, and outputs 'blah' to stdout. 
However, if I put this arg

args.push("blah blah");

It fails totaly. What I get on the stdout is corrupt 
path to helloworld.bat, although it has nothing to do with 
specifying that path.


var args:Vector.<String> = new Vector.<String>;


if (Capabilities.os.toLowerCase().indexOf("win") > -1)
{
  fPath = "C:\\Windows\\System32\\cmd.exe";
  args.push("/c");
  args.push(scriptDir.resolvePath("helloworld.bat").nativePath);                
}

file = new File(fPath);

var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = file;                     

args.push("blah");

nativeProcessStartupInfo.arguments = args;
process = new NativeProcess();
process.start(nativeProcessStartupInfo);



 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points