无忧启动论坛

标题: 为Win10或win11系统电脑右键添加以管理员身份运行cmd和powershell [打印本页]

作者: baolizhu    时间: 2025-3-24 11:22
标题: 为Win10或win11系统电脑右键添加以管理员身份运行cmd和powershell
把以下代码保存为,批处理双击运行即可,文件编码一定是ansi,别问为什么


REG ADD "HKCR\Directory\Background\shell\RunAs" /ve /t REG_SZ /d "@shell32.dll,-8506" /f
REG ADD "HKCR\Directory\Background\shell\RunAs" /v "Description" /t REG_SZ /d "@shell32.dll,-37445" /f
REG ADD "HKCR\Directory\Background\shell\RunAs" /v "Icon" /t REG_SZ /d "imageres.dll,-5324" /f
REG ADD "HKCR\Directory\Background\shell\RunAs" /v "MUIVerb" /t REG_SZ /d "@shell32.dll,-37444" /f
REG ADD "HKCR\Directory\Background\shell\RunAs" /v "NoWorkingDirectory" /t REG_SZ /d "" /f
REG ADD "HKCR\Directory\Background\shell\RunAs\command" /ve /t REG_SZ /d "cmd.exe /s /k pushd \"%%V\"" /f
REG ADD "HKCR\Directory\Background\shell\Windows.PowershellAsAdmin" /v "CanonicalName" /t REG_SZ /d "{ADB73FFC-1568-4D7D-BCD5-6D11A417AF64}" /f
REG ADD "HKCR\Directory\Background\shell\Windows.PowershellAsAdmin" /v "CommandStateSync" /t REG_SZ /d "" /f
REG ADD "HKCR\Directory\Background\shell\Windows.PowershellAsAdmin" /v "Description" /t REG_SZ /d "@shell32.dll,-37449" /f
REG ADD "HKCR\Directory\Background\shell\Windows.PowershellAsAdmin" /v "ExplorerCommandHandler" /t REG_SZ /d "{BF0AC53F-D51C-419F-92E3-2298E125F004}" /f
REG ADD "HKCR\Directory\Background\shell\Windows.PowershellAsAdmin" /v "Icon" /t REG_SZ /d "imageres.dll,-5373" /f
REG ADD "HKCR\Directory\Background\shell\Windows.PowershellAsAdmin" /v "ImpliedSelectionModel" /t REG_DWORD /d "1" /f
REG ADD "HKCR\Directory\Background\shell\Windows.PowershellAsAdmin" /v "MUIVerb" /t REG_SZ /d "@shell32.dll,-37448" /f
REG ADD "HKCR\Directory\Background\shell\Windows.PowershellAsAdmin" /v "ResolveLinksInvokeBehavior" /t REG_DWORD /d "3" /f
REG ADD "HKCR\Directory\Background\shell\Windows.PowershellAsAdmin" /v "ResolveLinksQueryBehavior" /t REG_DWORD /d "0" /f


也可以把以下内容保存为.reg的注册表文件双击导入也行
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Windows.PowershellAsAdmin]
"CanonicalName"="{ADB73FFC-1568-4D7D-BCD5-6D11A417AF64}"
"CommandStateSync"=""
"Description"="@shell32.dll,-37449"
"ExplorerCommandHandler"="{BF0AC53F-D51C-419F-92E3-2298E125F004}"
"Icon"="imageres.dll,-5373"
"ImpliedSelectionModel"=dword:00000001
"MUIVerb"="@shell32.dll,-37448"
"ResolveLinksInvokeBehavior"=dword:00000003
"ResolveLinksQueryBehavior"=dword:00000000

[HKEY_CLASSES_ROOT\Directory\Background\shell\RunAs]
@="@shell32.dll,-8506"
"Description"="@shell32.dll,-37445"
"Icon"="imageres.dll,-5324"
"MUIVerb"="@shell32.dll,-37444"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\RunAs\command]
@="cmd.exe /s /k pushd \"%V\""


附蓝奏https引号//baolizhu点lanzouu点com/i6z5o2rh31ri
作者: y迎旭    时间: 2025-3-24 12:40
感谢分享!
作者: 27377046    时间: 2025-3-24 13:14
感谢分享
作者: wang1126    时间: 2025-3-24 13:25
谢谢楼主分享
作者: yc2428    时间: 2025-3-24 13:39
感谢分享!
作者: guong    时间: 2025-3-24 13:59

谢谢楼主分享
作者: shiqiang    时间: 2025-3-24 18:40
感谢分享,正需要。
作者: snluwei    时间: 2025-3-24 19:31
谢谢分享
作者: 86933924    时间: 2025-3-24 20:41
谢谢分享
作者: 2012zhiwen    时间: 2025-3-24 23:51
有用,感谢。
作者: it323    时间: 2025-3-25 00:41
感谢分享! https://baolizhu.lanzouu.com/i6z5o2rh31ri
作者: 小灰兔    时间: 2025-3-25 06:29
感谢分享
作者: season111    时间: 2025-3-25 12:44

感谢分享
作者: fegr    时间: 7 天前
谢谢分享
作者: 86933924    时间: 6 天前
感谢大佬分享
作者: baolizhu    时间: 4 天前
本帖最后由 baolizhu 于 2025-3-29 20:59 编辑

来个powershell版
保存为.cmd或.bat
REG ADD "HKCR\Directory\Background\shell\SuperAsCmd" /v "Description" /t REG_SZ /d "@shell32.dll,-37445" /f
REG ADD "HKCR\Directory\Background\shell\SuperAsCmd" /v "Icon" /t REG_SZ /d "imageres.dll,-5324" /f
REG ADD "HKCR\Directory\Background\shell\SuperAsCmd" /v "MUIVerb" /t REG_SZ /d "@shell32.dll,-37444" /f
REG ADD "HKCR\Directory\Background\shell\SuperAsCmd" /v "NoWorkingDirectory" /t REG_SZ /d "" /f
REG ADD "HKCR\Directory\Background\shell\SuperAsCmd\Command" /ve /t REG_SZ /d "powershell -Command \"Start-Process cmd.exe -ArgumentList '/c \\\"cmd.exe\\\"' -Verb RunAs\"" /f
REG ADD "HKCR\Directory\Background\shell\SuperAsPowershell" /v "Icon" /t REG_SZ /d "imageres.dll,-5373" /f
REG ADD "HKCR\Directory\Background\shell\SuperAsPowershell" /v "MUIVerb" /t REG_SZ /d "@shell32.dll,-37448" /f
REG ADD "HKCR\Directory\Background\shell\SuperAsPowershell" /v "NoWorkingDirectory" /t REG_SZ /d "" /f
REG ADD "HKCR\Directory\Background\shell\SuperAsPowershell\Command" /ve /t REG_SZ /d "powershell -Command \"Start-Process PowerShell -Verb RunAs\"" /f


保存为.reg文件
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\SuperAsCmd]
"Description"="@shell32.dll,-37445"
"Icon"="imageres.dll,-5324"
"MUIVerb"="@shell32.dll,-37444"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\SuperAsCmd\Command]
@="powershell -Command \"Start-Process cmd.exe -ArgumentList '/c \\\"cmd.exe\\\"' -Verb RunAs\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\SuperAsPowershell]
"Icon"="imageres.dll,-5373"
"MUIVerb"="@shell32.dll,-37448"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\SuperAsPowershell\Command]
@="powershell -Command \"Start-Process PowerShell -Verb RunAs\""










欢迎光临 无忧启动论坛 (http://bbs.c3.wuyou.net/) Powered by Discuz! X3.3