如何从 RunAs 启动最小化的应用程序?

如何从 RunAs 启动最小化的应用程序?

我有一个在 Windows 10 中以提升的权限运行的批处理,因此它能够停止一些程序,备份/恢复文件,然后重新启动这些程序。

程序必须以正常权限启动,否则有些程序无法正常工作。我在 Google 上搜索解决方案,找到了一种适用于大多数程序的解决方案:

RunAs /savecred /user:myaccount "\"path to program\" /parameters"

我想让其中两个程序以最小化方式启动(explorer.exe 和 excel.exe),以前我使用“start "" /min "程序路径",但使用 RunAs 时,“start”无法识别为程序,因为它不以 .exe 格式存在,有没有办法在 RunAs 中运行“start”,或者有任何其他方法可以从 RunAs 中以最小化状态启动程序?

例如,如果我从提升的 cmd 运行:

start /min "C:\Windows\notepad.exe" -> starts elevated + minimized
RunAs /savecred /user:myaccount "C:\Windows\notepad.exe" -> starts not-elevated
RunAs /savecred /user:myaccount "start /min C:\Windows\notepad.exe" -> cannot find specified file
RunAs /savecred /user:myaccount "\"start\" /min \"C:\Windows\notepad.exe\"" -> cannot find specified file

编辑:类似于这个话题从 6 年前开始,他们还建议使用 RunAs 进行“启动”,但它根本不起作用。

相关内容