1. 目标
平台:Windows 10
实现右键文件夹内空白处,提示 ”在此打开 cmd’、“在此打开 Powershell”:
2. 添加 “在此打开 cmd” 步骤
-
Win + R 打开运行窗口,输入
regedit
,打开注册表窗口
-
打开
计算机\HKEY_CLASSES_ROOT\Directory\Background\shell
-
在 shell 下右键 > 新建项,命名为
open_cmd
> 设值为在此打开 cmd
-
在 shell 下右键 > 新建 > 字符串
Icon
> 双击或右键编辑,赋值为 cmd 窗口的路径- 查看 cmd 窗口路径:打开 cmd 文件路径
右键命令提示符打开目标:
打开后可以得到 cmd.exe 路径:
- 查看 cmd 窗口路径:打开 cmd 文件路径
-
综上所述,cmd.exe 文件路径为:
C:\Windows\system32\cmd.exe
-
所用的 Icon 的值可以设为 cmd.exe 路径值
所以设置 Icon 的值为:
-
在
open_cmd
下右键 > 新建项,命名为command
,设值为 cmd.exe 路径
-
在任意文件夹空白处测试:
扫描二维码关注公众号,回复: 14616637 查看本文章
能够正常打开:
3. 添加 “在此打开 powershell” 步骤
- 步骤与添加 “在此打开 cmd” 类似
-
Win + R 打开运行窗口,输入
regedit
,打开注册表窗口
-
打开
计算机\HKEY_CLASSES_ROOT\Directory\Background\shell
-
右键点击 shell > 新建项,命名为
open_powershell
,设置为 “在此打开 PowerShell”:
-
右键点击
open_powershell
> 新建字符串,命名为 Icon > 设值为 powershell.exe 的路径:- 查看 powershell.exe 路径
综上所述,powershell.exe 的路径为:C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
- 查看 powershell.exe 路径
- Icon 路径为:
- 右键点击
open_powershell
> 新建项,命名为 command > 设值为 powershell.exe 路径
- 测试一下
- 右键某文件夹内空白处
- 能够正常打开