用一条命令“以管理员身份运行 VBS”
AI 摘要salmon-ai
本文详细解析了如何通过一条命令以管理员身份运行 VBS 脚本。文章说明了 Windows 默认不会在 VBS 右键菜单中提供“以管理员身份运行”,并给出在 CMD 或 PowerShell 中使用
VBS 脚本默认右键是没有“以管理员身份运行”选项的,这是 Windows 的正常行为。
可以用下面 最稳妥、通用 的方式来解决 👇
在 CMD / PowerShell 里执行这条命令即可:
powershell
powershell -Command "Start-Process wscript.exe -ArgumentList '你的脚本路径.vbs' -Verb RunAs"
示例:
powershell
powershell -Command "Start-Process wscript.exe -ArgumentList 'D:\workspace\win2099\scripts\install-all-users.vbs' -Verb RunAs"
如果遇到报错:
powershell
D:\workspace\win2099\scripts>powershell -Command "Start-Process wscript.exe -ArgumentList 'D:\workspace\win2099\scripts\install-all-users.vbs' -Verb RunAs"
'powershell' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
则输入以下命令
powershell
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Command "Start-Process wscript.exe -ArgumentList 'D:\workspace\win2099\scripts\install-all-users.vbs' -Verb RunAs"
评论
0 条—
还没有评论,来说第一句