标签:.exe sarg log oid font ica ring 文件 resolve
private function callTest(event: Event): void
{
callExe("d:/a.exe");
callBat("d:/a.bat");
}
private function callExe(extUrl: String): void
{
//使用静态属性 NativeApplication.nativeApplication 获取应用程序的 NativeApplication 实例
//指定在关闭所有窗口后是否应自动终止应用程序。
NativeApplication.nativeApplication.autoExit = true;
//调用的文件
var file: File = new File();
file = file.resolvePath(extUrl);
var nativeProcessStartupInfo: NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = file;
var process: NativeProcess = new NativeProcess();
process.start(nativeProcessStartupInfo);
}
public static function callBat(batUrl: String): void
{
//调用bat文件
var exePath: String = "C:/Windows/system32/cmd.exe"; //cmd的路径
var info: NativeProcessStartupInfo = new NativeProcessStartupInfo(); //启动参数
info.executable = new File(exePath);
//参数
var processArg: Vector.<<span style="color:#2aa198;font-weight:bold;">String> = new Vector.<<span style="color:#2aa198;font-weight:bold;">String>();
processArg[0] = "/c"; //加上/c,是cmd的参数
processArg[1] = batUrl; //bat的路径
info.arguments = processArg;
//执行
var process: NativeProcess = new NativeProcess();
process.addEventListener(NativeProcessExitEvent.EXIT, packageOverHandler);
process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, outputHandler);
process.start(info);
}
private static function outputHandler(event: ProgressEvent): void
{
trace("outputHandler");
}
private static function packageOverHandler(event: NativeProcessExitEvent): void
{
trace("packageOverHandler event: NativeProcessExitEvent");
}
http://blog.sina.com.cn/s/blog_73bed4520102w69z.html
as3调用外部应用程序 as调用外部exe文件as3调用bat文件 未测试
标签:.exe sarg log oid font ica ring 文件 resolve
原文地址:https://www.cnblogs.com/dt1991/p/10336936.html