Jay*_*van 2 windows-7 powershell administrator
我正在寻找做这个问题中提出的问题:how to run a powershell script as administrator
接受的答案说使用快捷方式。我想这样做,但是当我进入高级属性时,一切都变灰了。我该如何解决这个问题?
诀窍是编辑 Shortcut 目标以添加powershell.exe
在脚本路径前面,使其看起来像这样:
powershell.exe -file "H:\Powershell\MyPoshScript.ps1"
Run Code Online (Sandbox Code Playgroud)
单击“确定”,然后返回“属性”,现在可以更改“以管理员身份运行”框。
(注意:当我这样做时,Windows 修复了 powershell.exe 对完整路径的引用。