我想要从 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]