日期:2014-05-17  浏览次数:21027 次

Windows: 也谈“触手可及的命令提示符” (续) : Win7对应

背景介绍 :

?

前面写过一篇博客, 叫做: Windows: 也谈“触手可及的命令提示符”

里面实现了这样的一个功能:

?

?

遇到的新问题:

?

前几天公司的电脑升级到了Windows7 64, 我发现上面那篇博客的做法现在对Win7-64失效了.

调查了一下, 在Win7上面, 要实现上面的功能, 可以使用下面的脚本(附件里面可下载):

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\cmd]
@="MS DOS(&Q)"

[HKEY_CLASSES_ROOT\Folder\shell\cmd\command]
@="cmd.exe /k pushd %L"
?

与XP的稍有不同, XP上面的代码如下:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\cmd]
@="MS DOS(&Y)"

[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@="cmd.exe cd %1"

?

其他资源 :

?

如果大家和我一样只想要这么一个功能, 那么直接导入上面的注册表即可.

如果大家想对这个问题有个更深入的了解, 可以参考下面的链接.

他们是我调查的过程中发现的, 涉及包括这一功能的其他方法实现, Windows的Build-in功能, UAC等等.

?

前面三个是微软的链接

cmd here in windows 7?

To configure the command prompt

Cmd

后面这三个是其他的链接.

Open Command Window Here

Windows Vista Open Command Prompt Here With Elevated Privilege

"Command prompt here" for files and folders

?

其中, 我尤其喜欢Open Command Window Here 这篇文章.

不仅因为他详细讨论了如何右键支持Windows的命令行提示符,

还因为

①给出了一份有参考价值的资源列表

②介绍了如何在右键菜单里面集成Unix Korn Shell,Unix Bash,Cygwin Bash,PowerShell这些命令行提示符.

这些命令行提示符的集成方式分别如下:

?

Unix Korn Shell:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\sfuksh]
@="Open SFU Ksh Here"
[HKEY_CLASSES_ROOT\Directory\shell\sfuksh\command]
@="C:\\WINDOWS\\system32\\POSIX.EXE /u /c /bin/ksh -l -c \"cd \\\"`chgpath -p '%L'`\\\";ksh\""

?

Unix Bash

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\sfubash]
@="Open SFU Bash Here"
[HKEY_CLASSES_ROOT\Directory\shell\sfubash\command]
@="C:\\WINDOWS\\system32\\POSIX.EXE /u /c /bin/ksh -l -c \"cd \\\"`chgpath -p '%L'`\\\";bash\""
?

?

Cygwin Bash

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\cygwinbash]
@="Open Cygwin Bash Here"
[HKEY_CLASSES_ROOT\Directory\shell\cygwinbash\command]
@="c:\\cygwin\\bin\\bash.exe --login -i -c \"cd \\\"`cygpath -u '%L'`\\\";bash\""
?

PowerShell

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\powershell]
@="PowerShell Here"
[HKEY_CLASSES_ROOT\Directory\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'"
?

?

?

?

?