MinGW(MSYS)添加到右键菜单方法

2013年5月4日 | 分类: 日志 | 标签:

原理与cygwin的修改方法一致,假定MingGW安装路径为D:\MinGW,在文件夹右键菜单里添加MinGW直接转到该文件夹路径方法如下:
1.复制D:\MinGW\msys\1.0\msys.bat文件到D:\MinGW\msys\1.0\msys2.bat,然后把msys2.bat里:EOF那行下面加上一个exit (为了解决一个蛋疼的bug)
2.修改D:\MinGW\msys\1.0\etc\profile文件,将cd “$HOME”那行替换为下面内容

#cd "$HOME"
if [ ! -z "${MHERE_INVOKING}" ]; then
  unset MHERE_INVOKING
else
  cd "${HOME}" || echo "WARNING: Failed attempt to cd into ${HOME}!"
fi

3.修改注册表regedit,将下面内容存为a.reg并打开导入到注册表:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\MinGW]
@="MSYS"

[HKEY_CLASSES_ROOT\Directory\shell\MinGW\command]
@="cmd.exe /k cd /d \"%1\" & set MHERE_INVOKING=1 & D:\\MinGW\\msys\\1.0\\msys2.bat"

或者手动修改:在HKEY_CLASSES_ROOT\Directory\shell\添加项MinGW(名字不重要),默认值为菜单里显示的文本MSYS,在此项里添加command项,默认值为cmd.exe /k cd /d "%1" & set MHERE_INVOKING=1 & D:\MinGW\msys\1.0\msys2.bat

此方法有个缺点,打开MSYS窗口过程中会另外有个cmd窗口闪一下。

目前还没有任何评论.

[cusFace:84] [cusFace:83] [cusFace:82] [cusFace:79] [cusFace:67] [cusFace:66] [cusFace:65] [cusFace:54] [cusFace:53] [cusFace:52] [cusFace:51] [cusFace:50] [cusFace:49] [cusFace:48] [cusFace:47] [cusFace:44] [cusFace:43] [cusFace:42] [cusFace:41] [cusFace:40] [cusFace:39] [cusFace:38] [cusFace:37] [cusFace:36] [cusFace:35] [cusFace:34] [cusFace:33] [cusFace:32] [cusFace:31] [cusFace:30] [cusFace:29] [cusFace:28] [cusFace:27] [cusFace:26] [cusFace:25] [cusFace:24] [cusFace:23] [cusFace:22] [cusFace:21] [cusFace:20] [cusFace:19] [cusFace:18] [cusFace:17] [cusFace:16] [cusFace:15] [cusFace:14] [cusFace:13] [cusFace:12] [cusFace:11] [cusFace:10] [cusFace:09] [cusFace:08] [cusFace:07] [cusFace:06] [cusFace:05] [cusFace:04] [cusFace:03] [cusFace:02] [cusFace:01] [cusFace:00]