程序员最常用的工具就是终端了,而最实用的功能就是如何在某个目录下,快速的进入终端,以便对该目录的文件做一些处理,本文分享一下如何在 Mac 和 Windows 下实现这个功能。
Mac
Mac 下,可以借助免费、好用、小巧的工具「超级右键[1]」,有了这个工具,Mac 的右键变得非常实用:
![32d800f03f625cd3a93cdbaa49d81f97.png](https://i-blog.csdnimg.cn/blog_migrate/583a0337bfe025edeb60e15f2c561bb5.png)
随便找个目录,然后右键,就可以出现打开终端:
![79efbbbc68fa15bab16000d5f76a3c99.png](https://i-blog.csdnimg.cn/blog_migrate/fa4cb74660038789c1eacfc3d5e9ebc5.png)
下载链接见文末。
Windows
Windows 没有找到更好的软件,即使有,我猜也有广告,不如直接改注册表来添加右键菜单,安全无广告又灵活可控。
新建一个文本文件,写入以下内容:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\runas0]
@="Open cmd here"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\shell\runas0\command]
@="cmd.exe /k pushd \"%V\""
[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open cmd here as Admin"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""
[-HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas0]
@="Open cmd here"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas0\command]
@="cmd.exe /k pushd \"%V\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="Open cmd here as Admin"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""
[-HKEY_CLASSES_ROOT\Drive\shell\runas]
[HKEY_CLASSES_ROOT\Drive\shell\runas]
@="Open cmd here as Admin"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Drive\shell\runas\command]
保存后,将文件重命名为 “cmd.reg”,注意文件的后缀名必须是 reg。
双击 cmd.reg 把它添加到注册表里面,然后找个目录右键,就可以看到需要的菜单了:
![ff62537cade99e504900ea7a865451be.png](https://i-blog.csdnimg.cn/blog_migrate/34ac59afaa4ce2d63396ac08aba547ec.png)
![a6c827c44324350b394e56edf64bb988.png](https://i-blog.csdnimg.cn/blog_migrate/113709124cfac98fbce490f0c02ca8cf.png)
![8e3592ac22440acf605e36c4aa12c20e.png](https://i-blog.csdnimg.cn/blog_migrate/20e233bda643d2955fb118571d563ec9.png)
![88b05b717dc7e6b6553d2dbbcacfab1f.png](https://i-blog.csdnimg.cn/blog_migrate/b4b93317556d2245aa67189c81871ad0.png)
最后的话
至此,你已经学会如何为鼠标右键增加「此处打开命令窗口」 了,是不是又解锁新技能了呢?如果觉得有帮助,还请点赞、在看、关注支持。
参考资料
[1]
超级右键: https://www.better365.cn