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'"
 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章