我需要通过 Flex 应用程序重新启动计算机,我尝试了以下方法:
第一
var process:NativeProcess;
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var file:File = File.applicationDirectory.resolvePath("assets/reboot.bat");
nativeProcessStartupInfo.executable = file;
process = new NativeProcess();
process.start(nativeProcessStartupInfo);
第二
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var mp:File = new File();
mp = mp.resolvePath('C:\Windows\System32\cmd.exe');
nativeProcessStartupInfo.executable = mp;
var args:Vector.<String> = new Vector.<String>();
args.push('shutdown.exe /s /t 00');
nativeProcessStartupInfo.arguments = args;
var process:NativeProcess = new NativeProcess();
process.start(nativeProcessStartupInfo);
最后,在这里,我的文件位于包含主应用程序的同一目录中名为 fscommand 的目录中
fscommand("exec", "reboot.bat");
和 reboot.bat 包含shutdown.exe /s /t 00
但是这些都不起作用......有人可以帮我解决这个问题^^谢谢