开发者

java-running executable with admin privilege

开发者 https://www.devze.com 2023-02-24 09:43 出处:网络
How to call executable bat filewith admin privilege from java program ? T开发者_Python百科hat executable is in another directory.You need use the runas command. Something like the following:

How to call executable bat file with admin privilege from java program ? T开发者_Python百科hat executable is in another directory.


You need use the runas command. Something like the following:

Runtime.exec("runas /user:ROOTUSERNAME c:\yourdir\yourbat.bat");

Of course, the windows ROOTUSERNAME user must have admin priviledge.

P.S.: I don't know why people voted this question down, it is a valid one...

0

精彩评论

暂无评论...
验证码 换一张
取 消