无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 678|回复: 15
打印 上一主题 下一主题

为Win10或win11系统电脑右键添加以管理员身份运行cmd和powershell

[复制链接]
跳转到指定楼层
1#
发表于 2025-3-24 11:22:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
把以下代码保存为,批处理双击运行即可,文件编码一定是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

评分

参与人数 1无忧币 +1 收起 理由
dayeye + 1

查看全部评分

2#
发表于 2025-3-24 12:40:49 | 只看该作者
感谢分享!
回复

使用道具 举报

3#
发表于 2025-3-24 13:14:36 | 只看该作者
感谢分享
回复

使用道具 举报

4#
发表于 2025-3-24 13:25:26 | 只看该作者
谢谢楼主分享
回复

使用道具 举报

5#
发表于 2025-3-24 13:39:19 | 只看该作者
感谢分享!
回复

使用道具 举报

6#
发表于 2025-3-24 13:59:50 | 只看该作者

谢谢楼主分享
回复

使用道具 举报

7#
发表于 2025-3-24 18:40:59 | 只看该作者
感谢分享,正需要。
回复

使用道具 举报

8#
发表于 2025-3-24 19:31:52 | 只看该作者
谢谢分享
回复

使用道具 举报

9#
发表于 2025-3-24 20:41:19 | 只看该作者
谢谢分享
回复

使用道具 举报

10#
发表于 2025-3-24 23:51:03 | 只看该作者
有用,感谢。
回复

使用道具 举报

11#
发表于 7 天前 | 只看该作者
回复

使用道具 举报

12#
发表于 7 天前 | 只看该作者
感谢分享
回复

使用道具 举报

13#
发表于 7 天前 | 只看该作者

感谢分享
回复

使用道具 举报

14#
发表于 6 天前 来自手机 | 只看该作者
谢谢分享
回复

使用道具 举报

15#
发表于 5 天前 | 只看该作者
感谢大佬分享
回复

使用道具 举报

16#
 楼主| 发表于 3 天前 | 只看该作者
本帖最后由 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\""





回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2025-4-1 03:37

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表