10 Replies Latest reply: Jun 24, 2015 5:28 AM by Jan-F-W RSS

    NativeProcess fails if args contain spaces

    mraak Community Member
      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);