为Windows资源管理器右键菜单添加菜单项

时间:2021-06-28 08:33:20

为Windows资源管理器右键菜单添加菜单项

在Windows下命令行用的比较多,经常在资源管理器里翻到某个目录,若想要在此目录下跑命令,只能是打开cmd.exe,然后一路cd才能到达此目录。

每次都这样太麻烦了,有没有简单的方法以资源管理器打开的目录为工作目录打开应用程序呢?研究了许久,答案是在资源管理器的右键菜单上添加菜单项,需要修改注册表。

下面是我添加的一些菜单项,这样就不用每次都打开cmd然后一路cd了。

REGEDIT4

[HKEY_CLASSES_ROOT\Directory\Background\shell]

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd]
@="CMD" [HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command]
@="cmd.exe /s /k pushd \"%V\"" [HKEY_CLASSES_ROOT\Directory\Background\shell\Cygwin]
@="Cygwin" [HKEY_CLASSES_ROOT\Directory\Background\shell\Cygwin\command]
@="D:\\ProgramFiles\\Cygwin\\bin\\mintty.exe -i /Cygwin-Terminal.ico" [HKEY_CLASSES_ROOT\Directory\Background\shell\JupyterNoteBook]
@="Jupyter Notebook" [HKEY_CLASSES_ROOT\Directory\Background\shell\JupyterNoteBook\command]
@="D:\\ProgramFiles\\Anaconda2\\Scripts\\jupyter-notebook.exe"

使用方法,把此代码保存到一个以.reg为后缀的文件,根据实际情况添删改然后保存。右击此文件点合并即可。