用惯了Linux下的bash,在Windows下对于那个cmd.exe很恼火,且不说双引号区分参数这样的“高级”问题,就是调个历史命令都麻烦得很,命令行编辑能力相当弱。

最近发现了clink这个扩展,可以让cmd.exe拥有几乎readline的全部能力。

clink: Bringing Bash's powerful command line editing to Microsoft Windows' cmd.exe

http://code.google.com/p/clink/

  • Powerful Bash-like line editing from GNU's Readline library. Read more on Readline's keyboard shortcuts.
  • Superior path completion (TAB).
  • Paste from clipboard (Ctrl-V).
  • Support for the completion of executables/commands, and environment variables.
  • Undo/Redo (Ctrl-_ or Ctrl-X, Ctrl-U)
  • Improved command line history.
    • Persists across sessions.
    • Searchable (Ctrl-R and Ctrl-S).
    • History expansion (e.g. !!, !<string>, and !$).
  • Scriptable completion using Lua.

 clink: 让Windows Cmd拥有readline能力

跟随cmd自动启动clink

clink的安装程序带有“Autorun when cmd.exe starts"选项,但如果你不想使用安装程序,又想要在启动cmd时自动启动clink,可以按如下办法:

  1. 打开注册表编辑器,找到(或者新建)HKEY_CURRENT_USER\Software\Microsoft\Command Processor
  2. 在该键下新建一个字符串项,名为AutoRun
  3. 将AutoRun的值设置为一个bat文件的路径,比如d:\cmdstart.cmd
  4. 编辑d:\cmdstart.cmd,里面写一句 d:\tools\clink /inject (当然你也可以再添加其他命令)

clink: 让Windows Cmd拥有readline能力 

 

分类:

技术点:

相关文章:

相关资源