![不只一個“以管理員身份在此開啟 xxxxx”](https://rvso.com/image/1466428/%E4%B8%8D%E5%8F%AA%E4%B8%80%E5%80%8B%E2%80%9C%E4%BB%A5%E7%AE%A1%E7%90%86%E5%93%A1%E8%BA%AB%E4%BB%BD%E5%9C%A8%E6%AD%A4%E9%96%8B%E5%95%9F%20xxxxx%E2%80%9D.png)
我想要以管理員身分從 Windows 中的磁碟機和目錄上下文功能表中開啟命令視窗或 Powershell 視窗的選項。
我可以有任何一個透過建立並填入下面所示的特殊「runas」註冊表項,但是有什麼方法可以讓兩個都列在上下文選單中並具有兩個都以管理員身份執行?
[HKEY_CLASSES_ROOT\Drive\shell\runas]
...
[HKEY_CLASSES_ROOT\Drive\shell\runas\command]
...
[HKEY_CLASSES_ROOT\Directory\shell\runas]
...
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
...
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
...
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
...
答案1
下一個登錄 hack 適用於 Windows 8.1 上的目錄:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\runas]
"HasLUAShield"=""
@="CMD here as administrator"
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /S /K pushd \"%V\""
"DelegateExecute"=""
[HKEY_CLASSES_ROOT\Directory\shell\runasPowerShell]
"HasLUAShield"=""
@="PowerShell here as administrator"
[HKEY_CLASSES_ROOT\Directory\shell\runasPowerShell\command]
@="Powershell Start-Process PowerShell -verb runas -ArgumentList '-noexit', 'Push-Location -literalPath ''\"%V\"'''"
"DelegateExecute"=""
您也可以在 下為磁碟機新增類似的runas
子項目。runasPowerShell
[HKEY_CLASSES_ROOT\Drive\shell]