不只一個“以管理員身份在此開啟 xxxxx”

不只一個“以管理員身份在此開啟 xxxxx”

我想要以管理員身分從 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]

使用提升的權限來執行 CMD 和 PowerShell

相關內容