Restart Computer via Flex Application
I need to restart the computer via a Flex Application, I tried these
methods :
1st
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);
2nd
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);
Finally, in here I have my file inside a directory named fscommand in the
same directory containing the main application
fscommand("exec", "reboot.bat");
and the reboot.bat contain shutdown.exe /s /t 00
But none of this works ... can anyone help me with this ^^ Thank you
No comments:
Post a Comment