![「管理者として xxxxx をここで開く」が複数あります](https://rvso.com/image/1466428/%E3%80%8C%E7%AE%A1%E7%90%86%E8%80%85%E3%81%A8%E3%81%97%E3%81%A6%20xxxxx%20%E3%82%92%E3%81%93%E3%81%93%E3%81%A7%E9%96%8B%E3%81%8F%E3%80%8D%E3%81%8C%E8%A4%87%E6%95%B0%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99.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
次のレジストリ ハックは、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]