AIR - 在 Windows 中启动本机进程不起作用
我试图在 Windows 7 中启动命令行可执行程序作为后台进程,但它不起作用。我的 AIR 应用程序是本机安装程序应用程序:myAIRApp.exe。
我已将 myApp.exe 与我的 AIR 应用程序捆绑在一起,以便在第一次启动时,应用程序会将 myApp.exe 复制到 applicationStorageDirectory (C:\Users\Administrator\AppData\Roaming\myAIRApp\ )。副本成功,但拒绝自行启动。在尝试启动之前副本已完成。我没有在任务管理器中显示为正在运行的进程,随后,依赖 myApp.exe 在后台运行的 AIR 应用程序失败。
如果我手动双击 applicationStorageDirectory 中复制的 myApp.exe,它将在 Windows 命令处理器中打开,因此文件没问题。该代码在我的 Mac 版本上也可以正常运行,但它不是启动 .exe,而是将 Mac 版本作为后台进程启动,手动启动时会在终端中打开。
该进程不接受任何参数,并且我的 AIR 应用程序不需要直接与启动的 .exe 后台进程进行通信。它只需要运行即可。
AIR 应用程序是在 Mac OS X 中编写的,我正在使用 Parallels Desktop 使用 ADT 编译 Windows 本机安装程序并测试该应用程序。
var myApp:File = File.applicationStorageDirectory.resolvePath("myApp.exe");
var myAppProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
myAppProcessStartupInfo.executable = myApp;
myAppProcess = new NativeProcess();
myAppProcess.start(myAppProcessStartupInfo);
任何想法为什么这可能不起作用?
i'm attempting to launch a command line executable program as a background process in Windows 7, but it's not working. my AIR application is a native installer application: myAIRApp.exe.
i've bundled myApp.exe with my AIR application, so that when it launches for the first time, the application copies myApp.exe to the applicationStorageDirectory (C:\Users\Administrator\AppData\Roaming\myAIRApp\ ). the copy is successful, but it refuses to launch on it's own. the copy is complete prior to trying to launch it. i doesn't show up as a running process in Task Manager and subsequently, my AIR application, which relies on myApp.exe to be running in the background, fails.
if i manually double-click the copied myApp.exe in the applicationStorageDirectory it will open in Windows Command Processor, so the file is fine. the code also works fine on my Mac version, but instead of launching an .exe it launches the the Mac version as a background process, which opens in Terminal when manually launched.
the process doesn't take any arguments and there is no requirement for my AIR application to directly communicate with the launched .exe background process. it only simply needs to be running.
the AIR application is authored in Mac OS X, and i'm using Parallels Desktop to compile the Windows native installer using ADT and to test the application.
var myApp:File = File.applicationStorageDirectory.resolvePath("myApp.exe");
var myAppProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
myAppProcessStartupInfo.executable = myApp;
myAppProcess = new NativeProcess();
myAppProcess.start(myAppProcessStartupInfo);
any ideas why this might not be working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许我错过了 AIR 文档中的某些内容,或者对 Windows 安全性没有足够的了解,但似乎 Windows 上的可执行文件无法从 applicationDirectory 之外的任何目录启动。
从 applicationDirectory 启动 .exe 是有效的。 (在 Windows XP 和 Windows 7 上测试)
perhaps i missed something in the AIR documentation or don't have a strong enough knowledge of Windows security, but it seems that executable files on Windows can not be launched from any directory other than the applicationDirectory.
launching the .exe from the applicationDirectory works. (tested on Windows XP and Windows 7)