flex调用.bat文件

 
        xmlns:s="library://ns.adobe.com/flex/spark"  
        xmlns:mx="library://ns.adobe.com/flex/mx"> 
  
   
 
 
 
  
      
   /**
    * flex调用.bat文件
    **/  
   public function flexCallBat():void{ 
    
    var cmdFile:File=new File(); 
    cmdFile = cmdFile.resolvePath("C:\\WINDOWS\\system32\\cmd.exe"); 
    var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo(); 
    nativeProcessStartupInfo.executable = cmdFile; 
    var processArgs:Vector. = new Vector.(); 
    
//     test.bat脚本内容如下(作用是在f盘创建一个test.txt文件)
//     
//     @echo off
//     set FILEDIR=F:\
//     @echo 1>%FILEDIR%test.txt
    
    processArgs[0] = "/c f:\\test.bat" ;//f:\\test.bat 为脚本在磁盘上的路径
    nativeProcessStartupInfo.arguments=processArgs; 
    var process:NativeProcess = new NativeProcess();
    process.start(nativeProcessStartupInfo);  
    process.closeInput();
   }
  ]]> 
 
 
 
  

你可能感兴趣的:(flex)