Overview
Clink combines the native Windows shell cmd.exe with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities. Readline is best known for its use in the Unix shell Bash, the standard shell for many Linux distributions.
For details, refer to the Clink documentation.
Starting Clink injects it into a
cmd.exe
process, where it intercepts a handful of Windows API functions so that it can replace the prompt and input line editing with its own Readline-powered enhancements.
Download
Downloads are available from the releases page.
See the issues page for known issues or to file new issues.
Feature Highlights
Auto-Suggestions
Clink offers suggestions as you type based on history, files, and completions.
C:\dir>findstr_/s needle haystack\*
Press Right or End to accept a suggestion (shown in a muted color).
Completions
Clink can complete words when you press Tab or Ctrl-Space.
Built-in completions are available for executables, aliases, command names, directory commands, and environment variables. You can use Lua scripts to add custom completions.
Persistent History
Clink stores persistent history between sessions.
- Up and Down cycle through history entries.
- PgUp and PgDn cycle through history entries matching the typed prefix.
- F7 show a popup list of selectable history entries.
- Ctrl-R and Ctrl-S search history incrementally.
Scriptable Prompt and Colored Input
You can customize the prompt dynamically with Lua scripts -- like in other shells -- but never before possible in cmd.exe!
C:\repos\clink git main->origin *3 !1
> git merge --help_
Your input is colored by context sensitive completion scripts.
Command Line Editing Improvements
Clink supercharges the command line with new input editing commands and configurable key bindings.
- Alt-H to display all key bindings.
- Tab for completion.
- Ctrl-Space for an interactive completion list.
- Ctrl-Z to undo input.
- Shift-Arrows to select text, and type to replace selected text.
Convenience
Optional auto-answering of the "Terminate batch job?" prompt.
Directory shortcuts:
dirname\
is a shortcut forcd /d
to that directory...
or...
are shortcuts forcd ..
orcd ..\..
(etc).-
orcd -
changes to the previous current working directory.
Installation
You can install Clink by running the setup EXE file from the releases page.
Or by using winget and running winget install clink
.
Or by using scoop and running scoop install clink
.
Or by downloading the ZIP file from releases page, and extracting the files to a directory of your choosing.
Usage
Once installed, there are several ways to start Clink.
-
If Clink is configured for autorun, just start
cmd.exe
and Clink is automatically injected and ready to use.The setup EXE has an option “Autorun when cmd.exe starts”. If you didn’t use the setup EXE, or if you want to enable or disable autorun later, you can run
clink autorun install
orclink autorun uninstall
to change the autorun configuration. Runclink autorun --help
for more info. - To manually start, run the Clink shortcut from the Start menu (or the clink.bat located in the install directory).
-
To establish Clink to an existing
cmd.exe
process, useclink inject
.If the Clink install directory isn’t in the PATH, then use
install_dir\clink
in place ofclink
to run Clink commands. Once Clink is injected into acmd.exe
process, then it automatically sets an alias so that you can simply useclink
.
You can use Clink right away without configuring anything:
- Searchable command history will be saved between sessions.
- Tab and Ctrl+Space will do match completion two different ways.
- Press Alt+H to see a list of the current key bindings.
- Press Alt+Shift+/ followed by another key to see what command is bound to the key.
See Getting Started for information on how to get started with using Clink.
Upgrading from Clink v0.4.9
The new Clink tries to be as backward compatible with Clink v0.4.9 as possible. However, in some cases upgrading may require a little bit of configuration work. More details can be found in the Clink documentation.
Extending Clink
Clink can be extended through its Lua API which allows easy creation of context sensitive match generators, prompt filtering, and more. More details can be found in the Clink documentation.