CLI tool
PowerShell/PSReadLine avatar
PowerShell/PSReadLine

PSReadLine: the module that replaces PowerShell's command line editing

A bash inspired readline implementation for PowerShell

4,361 stars342 forksC#BSD-2-Clause

At a glance

What is it?
PSReadLine swaps PowerShell's console line editor for a bash-inspired one with syntax coloring, multi-line editing, Ctrl+R history search and rebindable keys. Here is how it installs, what its configuration actually controls, and where it stops being the right tool.
Who is it for?
Adopt PSReadLine if you spend the day in an interactive PowerShell console, and especially if you want Ctrl+R history search, multi-line editing or custom key handlers. Skip it if your scripts run unattended, since the module only changes interactive input, and skip the prerelease channel unless you are willing to absorb new issues for newer fixes.
Can I use it commercially?
Yes. BSD-2-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 174 days ago.
What is it written in?
Mainly C#, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 27, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What PSReadLine replaces, and who ends up using it

PowerShell ships with a console host that has to accept typed input. PSReadLine takes over that job. The README states the module "replaces the command line editing experience of PowerShell for versions 3 and up", so it is not an add-on that sits beside the editor; it is the editor. Anyone who types commands interactively rather than launching a saved script is the intended user, and the README is explicit that the default experience should feel normal: "there should be no need to learn any new key strokes".

The feature list reads like a catalogue of small daily annoyances. Syntax coloring and simple syntax error notification while you type. A multi-line experience for both editing and history. Cmd and emacs edit modes, which the README describes as usable but not fully implemented. Bash-style completion, optional in Cmd mode and on by default in Emacs mode. Ctrl+R interactive history search in the bash/zsh style. An emacs yank/kill ring. Word movement and deletion based on PowerShell tokens rather than whitespace. Undo and redo. Automatic history saving, including sharing history across live sessions. Menu completion on Ctrl+Space, which the README compares loosely to Intellisense.

That combination explains why the module is nearly universal in PowerShell sessions without most users having chosen it deliberately. The interesting decision is not whether to use it, but whether to configure it.

How the editor is wired: key handlers, edit modes and buffer state

The mechanism is a key handler table. Keys are bound to functions, and the functions operate on the current command line buffer. Get-PSReadLineKeyHandler prints the current bindings, and Set-PSReadLineKeyHandler replaces one. That is the whole extension model, and it is more open than it first appears, because a binding can point at a script block instead of a built-in function.

Inside such a script block you get the key and its argument, and you call static methods on [Microsoft.PowerShell.PSConsoleReadLine] to read and mutate the line. The README lists four methods for this: GetBufferState, Insert, Replace and SetCursorPosition. The quote-insertion example in the README uses GetBufferState with [ref] parameters to read both the line and the cursor, checks whether the character after the cursor is the quote just typed, and either moves the cursor past it or inserts a matched pair and steps back one position.

Two details in that example matter more than the feature itself. First, the handler preserves undo correctly: the README notes that both inserted quotes are undone by a single undo. Second, the README points to the public methods of [Microsoft.PowerShell.PSConsoleReadLine] as the place to look for other built-in functionality you can call, which means custom bindings are not limited to the four named methods. Edit mode is a separate axis from bindings: Set-PSReadLineOption -EditMode Emacs switches the default key set, and the README says bash-style completion is the default there while it is optional in Cmd mode.

Installing PSReadLine and rebinding the arrow keys

Installation goes through the PowerShell Gallery, so PowerShellGet is the prerequisite. The README requires version 1.6.0 or higher to install or upgrade to the latest prerelease version. PowerShell 6 and later already ship a newer PowerShellGet, but Windows PowerShell 5.1 does not, so on 5.1 you first install the current PowerShellGet from an elevated session:

powershell
Install-Module -Name PowerShellGet -Force; exit

After that, the stable install is a single command. The -Scope CurrentUser argument keeps it out of the machine-wide module path, which avoids needing administrator rights for this step:

powershell
Install-Module PSReadLine -Repository PSGallery -Scope CurrentUser -Force

If you want the newest features and fixes before they are stable, the prerelease command is the same with -AllowPrerelease. The README attaches a warning to it: prerelease versions "will have newer features and bug fixes, but may also introduce new issues".

powershell
Install-Module PSReadLine -Repository PSGallery -Scope CurrentUser -AllowPrerelease -Force

Once it is loaded, the first useful change is usually the arrow keys. The README's example makes UpArrow and DownArrow behave like the normal console when the line is blank, and search history for commands starting with whatever you have already typed when it is not:

powershell
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward

To get bash-style completion without switching the whole editor to Emacs mode, the README binds Tab to Complete:

powershell
Set-PSReadLineKeyHandler -Key Tab -Function Complete

Run Get-PSReadLineKeyHandler afterwards to confirm the new bindings are listed. For a fuller starting point, the README points at the sample profile file, SamplePSReadLineProfile.ps1, which is included when the module is installed and contains a set of examples.

Where PSReadLine is the wrong tool

PSReadLine changes interactive input. That is the entire scope, and it is worth saying plainly because it is easy to expect more. A script run non-interactively does not gain syntax coloring or history search; there is no console line to edit. Automating a build, a scheduled task or a CI step with PSReadLine in mind is a category error.

There is a second boundary that the README states rather than hides. Cmd and emacs modes are both described as "neither are fully implemented yet, but both are usable". If your workflow depends on an emacs binding that has not been implemented, no amount of configuration will produce it, though a custom key handler can approximate some of them.

The dependency on PowerShellGet is a third constraint, and it bites hardest exactly where PowerShell is oldest. Windows PowerShell 5.1 ships a PowerShellGet too old to install prerelease modules, so the elevated Install-Module PowerShellGet step is not optional there. The README also notes that the module can already be in use, which is the situation behind the common "PSReadLine is currently in use" message: you cannot simply swap the loaded module out from under an active session. The README does not document a rollback procedure for a bad upgrade, so plan around the upgrade rather than assuming you can reverse it in place.

PSReadLine versus the plain PowerShell console

The alternative is not another module. It is the console host's own editing, which is what you get when PSReadLine is absent or disabled. The difference in approach is that the built-in editor knows nothing about PowerShell syntax: it treats the line as text, so word movement stops at whitespace instead of at token boundaries, and there is no syntax coloring or error notification as you type. History search is a linear walk rather than the Ctrl+R incremental search the README describes.

For a short one-off command, that gap does not matter. For anything involving a long pipeline, quoting, or a command you half-remember from last week, it does. The comparison is not about speed of the editor; it is about how much of the line's structure the editor can see. PSReadLine sees tokens, which is why the README can offer token-based word movement and kill, and why menu completion on Ctrl+Space can present candidates rather than completing a path. The built-in console sees characters.

There is also a configuration cost to weigh. The default PSReadLine experience is deliberately close to the old one, so an unconfigured install is a modest change. The moment you start rebinding keys, you own a profile that has to be carried between machines and kept working across module upgrades. That is a real cost, and it is the reason to add bindings one at a time rather than copying a large profile wholesale.

Maintenance, releases and what the BSD-2-Clause licence means here

The repository is not archived, and the last push was on 2026-04-08. Release cadence is visible in the tags: v2.4.5 landed on 2025-10-22, preceded by v2.4.4-beta4 on 2025-08-29 and v2.4.3-beta3 on 2025-07-23. The pattern is a beta line feeding a stable line, which is consistent with the README's own framing of prereleases as newer but riskier. Upgrading is a single Install-Module command, so the mechanical cost is low; the cost that is not mechanical is re-testing custom key handlers after a version change, since those call into [Microsoft.PowerShell.PSConsoleReadLine] and the README does not promise that surface is frozen.

Building from source is a heavier commitment. The README lists .NET 6.0 or newer plus the InvokeBuild and platyPS modules, and the build script build.ps1 handles bootstrap, build and test:

powershell
./build.ps1 -Bootstrap
./build.ps1 -Configuration Debug

The repository layout matches that story: PSReadLine.build.ps1, build.ps1, a test directory, a MockPSConsole project and a tools directory sit at the top level. On licensing, the project is BSD-2-Clause, which is permissive and imposes few conditions on redistribution, but the practical question for most users is not the licence text; it is which module version is loaded and from which path. This is a general observation about the licence identifier, not legal advice.

Editorial conclusion

Adopt PSReadLine if you spend the day in an interactive PowerShell console, and especially if you want Ctrl+R history search, multi-line editing or custom key handlers. Skip it if your scripts run unattended, since the module only changes interactive input, and skip the prerelease channel unless you are willing to absorb new issues for newer fixes. Before rolling it out, check which version is already loaded with Get-Module PSReadLine, because the README warns that the module can already be in use, and verify the PowerShellGet version on Windows PowerShell 5.1, which ships one too old to install prerelease modules.

Frequently asked questions

What does PSReadLine do in PowerShell?

It replaces the command line editing experience of PowerShell for versions 3 and up. That includes syntax coloring, simple syntax error notification, multi-line editing and history, customizable key bindings, bash-style completion and Ctrl+R interactive history search.

How do I install PSReadLine?

Install it from the PowerShell Gallery with Install-Module PSReadLine -Repository PSGallery -Scope CurrentUser -Force. To get prerelease builds instead, add -AllowPrerelease, which requires PowerShellGet 1.6.0 or higher.

How do I use PSReadLine?

Switch edit modes with Set-PSReadLineOption -EditMode Emacs, inspect the current bindings with Get-PSReadLineKeyHandler, and change one with Set-PSReadLineKeyHandler. The module also ships an about_PSReadLine help topic and cmdlet help.

Where is PSReadLine located?

The README does not state an install path. It does say the sample profile file SamplePSReadLineProfile.ps1 is included when the module is installed, and that installation is done through the PowerShell Gallery repository PSGallery.

What is the PSReadLine module?

It is a module that takes over PowerShell console line editing, implemented in C# and published under the BSD-2-Clause licence. The README describes it as a bash inspired readline implementation for PowerShell.

What is PSReadLine in PowerShell?

It is the module that provides the console's line editing, including syntax coloring, simple syntax error notification, multi-line editing and history, and configurable key bindings. The README says it applies to PowerShell versions 3 and up.

Official sources

  1. Issues
  2. License: BSD-2-Clause
  3. PowerShell/PSReadLine on GitHub
  4. README
  5. Releases
For maintainers

Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/powershell-psreadline.svg)](https://hysenlabs.com/projects/powershell-psreadline)
Community notes

Community notes