假设
Runtime.getRuntime().exec("cmd /c net start tomcat")
会运行失败,提示说
发生系统错误 5。拒绝访问。
可以使用:nircmd代替
Runtime.getRuntime().exec("c:/nircmd.exe elevate net start tomcat")
即可解决管理权限问题
nircmd
主页:
官方下载地址:
官方64位下载地址:
本文共 250 字,大约阅读时间需要 1 分钟。
假设
Runtime.getRuntime().exec("cmd /c net start tomcat")
会运行失败,提示说
发生系统错误 5。拒绝访问。
可以使用:nircmd代替
Runtime.getRuntime().exec("c:/nircmd.exe elevate net start tomcat")
即可解决管理权限问题
nircmd
主页:
官方下载地址:
官方64位下载地址:
转载于:https://my.oschina.net/banbang/blog/492972