调用AIR(AS3)时,cmd.exe不会显示

时间:2014-08-29 10:35:20

标签: windows actionscript-3 flash air cmd

当我使用AIR调用cmd.exe时,它不会显示,但会显示在任务管理器中。当我将参数传递给cmd.exe时,它没有反应。调用notepad.exe或wscript.exe时代码没有问题。(舞台上有一个名为btn的按钮)这是我的代码:

import flash.desktop.NativeProcess;
import flash.desktop.NativeProcessStartupInfo;
import flash.filesystem.File;
btn.addEventListener(MouseEvent.CLICK, invokeCmd);
function invokeCmd(e:MouseEvent):void{
    if(NativeProcess.isSupported){
        btn.label="NativeProcess supported";
        var info:NativeProcessStartupInfo = new NativeProcessStartupInfo();
        info.executable = new File("C:/Windows/System32/cmd.exe");
        var processArg:Vector.<String> = new Vector.<String>();
        processArg.push("start dir");
        info.arguments = processArg;
        var process:NativeProcess = new NativeProcess();
        process.start(info);
    }
}

0 个答案:

没有答案