Windows10:将cmd命令行添加到右键中的方法

Windows下如何将cmd命令添加到右键菜单

由于经常要使用到cmd命令,为了省去每次重新打开cmd窗口后层层寻找目标路径的麻烦,找了一个办法将cmd命令添加到右键菜单里,这样在目标路径下就可以直接右键进入,实现方法如下:

导入注册表方式:将以下文本复制保存为reg文件,或者直接下载,点击运行,提示框点确定完成后可以看到右键菜单有了。

新建一个文件名称为:cmd_youji.reg,写入如下内容;

Windows Registry Editor Version 5.00
; 若原先有,先删除原来的
[-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
; 1.右键:命令行 @后为显示名字,icon为图标
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
@="Open with cmd"
"Icon"="C:\\windows\\system32\\cmd.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere\command]
@="cmd.exe -noexit -command Set-Location -literalPath \"%V\""  
; 2.右键:命令行(管理员)
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="Open with cmd(admin)"
"Icon"="C:\\windows\\system32\\cmd.exe"
"ShowBasedOnVelocityId"=dword:00639bc8
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

说明:

命令解释:[]   代表注册表路径,前面-代表删除此项;

@后面是注册表默认值,icon代表程序图标

发布了295 篇原创文章 · 获赞 37 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/tianshan2010/article/details/104795345