# Clink: Bringing GNU Readline Editing to cmd.exe

> Clink grafts Bash-style line editing, persistent history, and Lua-scriptable completion onto Windows cmd.exe. It is a mature tool with a slow release cadence, and it is GPL-3.0 licensed.

**mridgers/clink** — GitHub describes it as Bash's powerful command line editing in cmd.exe. The repository metadata lists C as its primary language. The metadata lists the GPL-3.0 license. This article stays within the project description and details documented in the GitHub repository README.

- Repository: https://github.com/mridgers/clink
- Website: mridgers.github.io/clink
- Stars: 3,315 · Forks: 286
- Language: C
- License: GPL-3.0
- Published: 2026-08-13 · Updated: 2026-08-18 · Language: en
- Canonical page: https://hysenlabs.com/projects/mridgers-clink

## What Clink Solves and Who It Serves

Clink targets a specific pain: cmd.exe's default line editing is primitive. You get arrow keys, F7 for history, and not much else. Clink replaces that with the GNU Readline library, the same editing engine behind Bash. The result is that you can use Ctrl-A to jump to the start of a line, Ctrl-E to go to the end, Ctrl-K to kill to the end, and Ctrl-R for incremental history search. The primary audience is Windows administrators and developers who are stuck with cmd.exe for legacy scripts or habit, but who want a more productive editing experience. It is not a new shell; it is an enhancement to the existing one. The README is clear that Clink combines cmd.exe with Readline, so the underlying shell remains unchanged. This is both its strength and its limitation: you get better editing, but no new scripting language or pipeline features.

## The Mechanism: Injection and Readline

Clink works by injecting itself into a running cmd.exe process. The README gives three ways to start it: an auto-run that starts with cmd.exe, a manual shortcut, or the explicit command clink.exe inject to attach to an existing process. That injection model is what makes Clink feel native. Once injected, Readline takes over the input loop, handling key presses and line editing. The documentation is thin on the technical details of the injection, but the mechanism is clear from the usage instructions. This is a different approach from a wrapper like ConEmu or a new shell like PowerShell. Clink does not replace cmd.exe; it sits inside it. This means that any script or tool that launches cmd.exe will benefit from Clink if the auto-run is installed, but only if the injection succeeds. The README does not mention any failure modes of injection, but it is reasonable to expect that some environments, such as restricted user accounts or certain terminal emulators, may block it.

## Getting It Running: Commands and Config

Installation is straightforward. You download the latest release from the GitHub releases page. Then you have three options. First, if you enabled auto-run during install, every new cmd.exe window already has Clink active. You can manage that with clink autorun --help. Second, you can run the Clink shortcut from the Start menu, which launches cmd.exe with Clink attached. Third, you can inject into an existing cmd.exe process by running <install_dir>\clink.exe inject. That last option is useful for attaching to a session you already have open. The README also mentions a clink.bat file in the install directory, which presumably does the same as the shortcut. Beyond that, the README does not list any configuration files or environment variables. The real configuration happens through the Lua API, which is documented in docs/clink.md. That file is not included in the README, but it is linked. So the practical setup is: install, choose your start method, and then optionally write Lua scripts to customize completion and the prompt.

## Completion and Extensibility via Lua

Clink's completion system is context sensitive. The README lists executables, aliases, directory commands, environment variables, and third-party tools like Git, Mercurial, SVN, Go, and P4. That means when you type git che and press Tab, you get git commands. The mechanism behind this is a Lua API that allows match generators. You can write Lua scripts to add completions for your own tools. The README says the API allows 'easy creation context sensitive match generators, prompt filtering, and more.' This is a significant extension point. It is what separates Clink from a simple Readline wrapper. You are not stuck with the built-in completions; you can add your own. The documentation in docs/clink.md is the reference for that API. The README does not give an example Lua script, so you would need to read that file to get started. The prompt can also be scripted and coloured, which is another Lua hook. This makes Clink a platform for customizing the cmd.exe experience, not just a set of keyboard shortcuts.

## Limitations and Failure Modes

The most obvious limitation is that Clink only improves line editing and completion. It does not fix cmd.exe's other shortcomings, such as weak scripting, lack of structured output, or inconsistent error handling. If you need those, you should use PowerShell. Another limitation is the release status. The latest release is 1.0.0a5, an alpha. The previous release was 1.0.0a4 from June 2023, and before that 1.0.0a1 from 2018. The gap between a1 and a4 was five years. That suggests a slow development pace. The project is not archived, and the last push was August 2024, so it is alive, but you should not expect rapid updates. The README does not mention any known issues, but the alpha status implies that bugs may exist. One specific failure mode is the auto-answering of the 'Terminate batch job?' prompt. The README lists it as a feature, but if it misfires, it could kill a batch job you wanted to keep. The README does not say how to disable that feature. You would have to dig into the Lua API or the documentation to find a setting.

## Alternatives and Comparisons

The closest alternative is to use PowerShell, which has its own line editing features, including syntax highlighting and tab completion. PowerShell is a full shell, not an enhancement, so it replaces cmd.exe entirely. That is a different approach: instead of bolting Readline onto cmd.exe, you switch to a shell that was built with modern features. Another alternative is to use Windows Terminal with the default cmd.exe, but that only gives you a better display, not better editing. There is also the option of using Git Bash, which includes Readline and a Unix-like environment, but that is a separate shell, not an injection into cmd.exe. The key difference with Clink is that you keep cmd.exe and all its scripts intact. You do not have to change your workflow or learn a new scripting language. That is a real advantage for legacy environments. The trade-off is that you are still limited by cmd.exe's parser and error handling.

## Maintenance and License Implications

Clink is licensed under GPL-3.0. That means if you distribute Clink or a modified version, you must make the source code available under the same license. For internal use, there is no obligation. The README states this plainly. The project uses Premake to generate build files, which is a build system that uses Lua scripts. To build from source, you need Premake 5.0-alpha12 or later. The build process is described: run premake5.exe <toolchain>, then build with your toolchain. The generated files go into .build\<toolchain>\, for example .build\vs2013\clink.sln. That is a standard workflow for C projects. The maintenance cost is low if you use the pre-built binaries from releases. You just download and run. If you want to patch or extend, you need to understand the C codebase and the Lua API. The alpha status means you should test upgrades carefully, as the API might change between alpha versions.

## Conclusion

Clink is for Windows users who spend long hours in cmd.exe and want Bash-like editing without switching to PowerShell or Windows Terminal. It is not for users who need a full shell replacement or who are allergic to GPL-3.0. Before adopting it, verify that the alpha release works with your Windows version and that the Lua API covers the completions you need. The project's last push was in August 2024, and the latest release is still an alpha, so expect occasional rough edges.

## FAQ

### What does mridgers/clink do?

It combines the native Windows shell cmd.exe with the line editing features of the GNU Readline library, which is best known for its use in Bash. That brings completion, history and line editing to cmd.exe, along with a scriptable prompt and Lua-based completion.

### How do you start clink?

Three ways are given. If the auto-run is installed you simply start cmd.exe. Otherwise you can run the Clink shortcut from the Start menu or the batch file in the installation directory. To attach to a shell that is already running, the inject executable is used against an existing cmd.exe process.

### What kinds of things does clink complete?

Four categories: executables and aliases, directory commands, environment variables, and third-party tools, with Git, Mercurial, Subversion, Go and Perforce named as the tools it knows about. Completion can be extended further through its Lua API.

### What licence is clink released under?

The GNU General Public License version 3. The readme states that Clink is distributed under those terms, the repository index records the same licence, and a LICENSE file is present at the root of the tree.

### How is clink built from source?

With Premake generating Visual Studio solutions or MinGW makefiles, requiring Premake 5.0-alpha12 or newer. Running premake5 with a toolchain action writes the generated scripts into a per-toolchain directory under .build, after which Visual Studio, mingw32 make or MSBuild can be called.

## Sources

- [Official README](https://github.com/mridgers/clink#readme)
- [Project repository](https://github.com/mridgers/clink)
- [Release notes](https://github.com/mridgers/clink/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/mridgers-clink
