添加cmd和powershell到右键菜单的一键脚本
如默
撰写于 2019年 11月 16 日

说明

为了方便起见,将cmd或powershell添加到右键菜单,管理员和非管理员权限,特记录于此。

脚本

此处记录脚本内容,注意分号;之后的内容是注释

cmd(非管理员)

Windows Registry Editor Version 5.00

; 添加到桌面右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_here]

@="在此处打开命令行"
"Icon"="cmd.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_here\command]

@="\"C:\\Windows\\System32\\cmd.exe\""

; 添加到文件夹右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_here]

@="在此处打开命令行"
"Icon"="cmd.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_here\command]

@="\"C:\\Windows\\System32\\cmd.exe\""

Windows PowerShell(非管理员)

Windows Registry Editor Version 5.00

; 添加到桌面右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell_here]

@="在此处打开PowerShell"
"Icon"="powershell.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell_here\command]

@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\""

; 添加到文件夹右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell_here]

@="在此处打开PowerShell"
"Icon"="powershell.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell_here\command]

@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\""

cmd(管理员)

Windows Registry Editor Version 5.00

; 添加到桌面右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_admin_here]

@="在此处打开命令行(管理员)"
"Icon"="cmd.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_admin_here\command]

@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""

; 添加到文件夹右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_admin_here]

@="在此处打开命令行(管理员)"
"Icon"="cmd.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_admin_here\command]

@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""

Windows PowerShell(管理员)

Windows Registry Editor Version 5.00

; 添加到桌面右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell_admin_here]

@="在此处打开PowerShell(管理员)"
"Icon"="powershell.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell_admin_here\command]

@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" Start-Process PowerShell -verb RunAs"

; 添加到文件夹右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell_admin_here]

@="在此处打开PowerShell(管理员)"
"Icon"="powershell.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell_admin_here\command]

@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" Start-Process PowerShell -verb RunAs"

步骤

  1. 复制脚本到记事本或notepad++等编辑器上
  2. 保存为.reg格式的注册表文件
  3. 运行刚刚保存好的注册表文件,提示确定添加时,点击是

OK,大功告成

管理员身份运行时,会先弹出一个powershell框,然后再弹出授权,授权之后才会出现管理员身份的powershell。暂时没有找到可与去除第一个弹框的办法。

此方式添加完毕后,如果在桌面回收站右键显示在此处打开命令行,请打开注册表编辑器,删除此位置计算机\HKEY_CLASSES_ROOT\Folder\shell下的cmd_herepowershell_here文件夹即可

添加cmd和powershell到右键菜单的一键脚本

温馨提示:

本文最后更新于2019年11月16日,已超过1898天没有更新,若内容或图片失效,请留言反馈。

说明

为了方便起见,将cmd或powershell添加到右键菜单,管理员和非管理员权限,特记录于此。

脚本

此处记录脚本内容,注意分号;之后的内容是注释

cmd(非管理员)

Windows Registry Editor Version 5.00

; 添加到桌面右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_here]

@="在此处打开命令行"
"Icon"="cmd.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_here\command]

@="\"C:\\Windows\\System32\\cmd.exe\""

; 添加到文件夹右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_here]

@="在此处打开命令行"
"Icon"="cmd.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_here\command]

@="\"C:\\Windows\\System32\\cmd.exe\""

Windows PowerShell(非管理员)

Windows Registry Editor Version 5.00

; 添加到桌面右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell_here]

@="在此处打开PowerShell"
"Icon"="powershell.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell_here\command]

@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\""

; 添加到文件夹右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell_here]

@="在此处打开PowerShell"
"Icon"="powershell.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell_here\command]

@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\""

cmd(管理员)

Windows Registry Editor Version 5.00

; 添加到桌面右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_admin_here]

@="在此处打开命令行(管理员)"
"Icon"="cmd.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_admin_here\command]

@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""

; 添加到文件夹右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_admin_here]

@="在此处打开命令行(管理员)"
"Icon"="cmd.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_admin_here\command]

@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""

Windows PowerShell(管理员)

Windows Registry Editor Version 5.00

; 添加到桌面右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell_admin_here]

@="在此处打开PowerShell(管理员)"
"Icon"="powershell.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell_admin_here\command]

@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" Start-Process PowerShell -verb RunAs"

; 添加到文件夹右键菜单

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell_admin_here]

@="在此处打开PowerShell(管理员)"
"Icon"="powershell.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell_admin_here\command]

@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" Start-Process PowerShell -verb RunAs"

步骤

  1. 复制脚本到记事本或notepad++等编辑器上
  2. 保存为.reg格式的注册表文件
  3. 运行刚刚保存好的注册表文件,提示确定添加时,点击是

OK,大功告成

管理员身份运行时,会先弹出一个powershell框,然后再弹出授权,授权之后才会出现管理员身份的powershell。暂时没有找到可与去除第一个弹框的办法。

此方式添加完毕后,如果在桌面回收站右键显示在此处打开命令行,请打开注册表编辑器,删除此位置计算机\HKEY_CLASSES_ROOT\Folder\shell下的cmd_herepowershell_here文件夹即可


赞 (0)

猜您想看

  • AMD R5 5600X装机记录

    在今年年初的时候,把电脑的硬件几乎都换了一遍,当时的工作比较忙,也没顾上记录,今天正好记录一下,补上为自己第二次装机之旅。

    2022年12月16日
  • Magic Trackpad使用体验(Windows11 和 Mac OS13.2)

    如题,我购买了apple的Magic Trackpad和一台Mac Mini,但是后者预计发货时间在月底,可秒控板首先到了,没有Mac,不能测试触控板吗?幸好,我在全球最大的同性交友网站上找到了相关驱动,记录一下。

    2023年02月19日
  • Gradle/Maven配置国内镜像源(以Android Studio为例)

    Gradle源在国外,国内构建项目的时候经常报错连接超时,修改国内镜像可以解决。

    2019年10月18日
  • AMD RX 6750XT显卡黑屏问题解决办法

    前两天买了一个技嘉小雕 RX 6750XT ELITE 12G独立显卡,刚装上之后Windows自动更新了驱动,结果,玩游戏黑屏,时不时的来一下,还很恶心,然后查资料,几经折腾,目前一切稳定,分享一下

    2022年12月22日
  • python poetry配置国内镜像

    poetry默认的源总是超时,修改一下国内源。

    2024年12月19日
  • 二进制安装和Docker安装Gitea的SSH配置

    前面两天使用了Gitea,发现使用ssh协议克隆有点问题,特此记录。

    2022年12月01日

评论区(暂无评论)

这里空空如也,快来评论吧~

我要评论

Vaptcha 初始化中...