java - How to call a batch file from a windows service? -
we have java application, running windows service. need call batch file start windows 'calculator' application. can't. if start java application not windows service, working fine. have read post same on calling batch file windows service , done below configuration.
"first install service giving appropriate path batch file or exe file go run->services.msc->right click on service ->properties->logon->check enable service interact desktop-make enable "
after got partial success, first prompts permission window below:
may suggest instead of opening batch file, open calc.exe file instead?
runtime.getruntime().exec("c:\\windows\\system32\\calc.exe", null, new file("c:\\windows\\system32\\calc.exe"));
edit: if still want run batch file, use this:
runtime.getruntime().exec("cmd /c start nameofthebatchfile.bat");
please note second variable in exec method set directory want calling program from.
Comments
Post a Comment