PSReadLine swaps PowerShell's raw console buffer for a readline line editor
A bash inspired readline implementation for PowerShell
At a glance
- What is it?
- PSReadLine is the C# module that replaces the PowerShell console line editor with syntax coloring, emacs and cmd key bindings, history search and a scriptable key handler API. It is a good fit for anyone typing long PowerShell pipelines by hand, and the wrong layer for anyone who needs full IntelliSense inside the console.
- Who is it for?
- Adopt PSReadLine if you write multi-line PowerShell by hand and want emacs bindings, history search and undo in the raw console. Skip it if your workflow depends on real completion intelligence inside the window, since the README itself calls Ctrl+Space menu completion only somewhat like IntelliSense, and pick an editor-backed host instead.
- 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 27 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 November 15, 2026, and from our analysis. They are not legal advice.
Star history
- PowerShell/PSReadLine4,396 ★ · +38
| Repository | 2026-09-23 | 2026-11-15 |
|---|---|---|
| PowerShell/PSReadLine | 4.4k | 4.4k |
38 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The console line editor PSReadLine takes over
Out of the box, PowerShell's console reads a line, hands it to the parser, and throws it away. PSReadLine replaces exactly that layer. It is a C# module that hooks the console host's line editing for PowerShell versions 3 and up, and it does it without changing the language or the pipeline itself.
What lands in the reader is a line buffer with a cursor you can move, a kill ring, and undo. Around that sit syntax coloring as you type and simple syntax error notification, so a stray bracket shows up before you press Enter rather than in a red wall of parser output afterwards.
The design intent is stated bluntly: the out-of-box experience is meant to be very familiar to PowerShell users, with no need to learn new key strokes. That is a constraint, not a boast. It explains why both key-binding modes are called out in the README as neither fully implemented yet, but both usable.
The audience is anyone who types commands, and especially anyone who pastes and edits long ones. Every key press happens through this module, so its bugs land in the middle of your work.
Emacs and Cmd modes share one incomplete implementation
Two editing modes exist, and the README is unusually candid that neither is finished. Bash style completion is optional in Cmd mode and the default in Emacs mode, so the two modes do not behave identically out of the box.
Switching modes is one cmdlet:
Set-PSReadLineOption -EditMode EmacsEverything else is funnelled through key handler functions rather than hardcoded keys. That indirection is the actual mechanism. A key is bound to a named function, and you rebind the key, not the editor:
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForwardWith those two lines, UpArrow behaves like the stock cmd or PowerShell history only when the buffer is empty. Once you have typed text, the same key searches history for commands starting with what you typed. Same key, two behaviours, decided by buffer state.
To see what is bound right now, run Get-PSReadLineKeyHandler. That output is the closest thing to a real inventory of the editor, and it is worth reading before you start rebinding, because the default map is longer than most users expect.
SmartInsertQuote and the buffer API custom handlers call
A custom binding can move the cursor, but for anything more it calls into a static class. The README's SmartInsertQuote example reads the buffer, checks whether the character after the cursor is the quote you just typed, and either steps the cursor past it or inserts a matched pair with the cursor between them.
The two calls that do the work are GetBufferState and SetCursorPosition:
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
[Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($cursor + 1)Four public methods cover the common cases: GetBufferState, Insert, Replace and SetCursorPosition. They are the extension surface for anything the built-in functions do not do.
One detail in the example is worth pulling out. Written this way, the handler handles undo correctly: both quotes are undone with one undo.
Installing from PSGallery, and the PowerShellGet version that blocks it
Windows PowerShell 5.1 is the awkward case. It ships an older PowerShellGet that cannot install prerelease modules, so the documented path is to update PowerShellGet first, from an elevated session:
Install-Module -Name PowerShellGet -Force; exitThen install or upgrade, current user scope, prereleases allowed:
Install-Module PSReadLine -Repository PSGallery -Scope CurrentUser -AllowPrerelease -ForceDrop -AllowPrerelease if you only want the stable channel. PowerShell 6 and later need none of this, since a newer PowerShellGet is built in.
The README attaches a warning to the prerelease path: prerelease versions carry newer features and bug fixes but may also introduce new issues. The most recent release is the stable v2.4.5 (2025-10-22), which followed the beta builds v2.4.3-beta3 and v2.4.4-beta4.
History is saved automatically and shared across live sessions
History handling is the least visible part of the module. The README lists automatic saving of history, including sharing history across live sessions. Two live windows of the same user can therefore see each other's commands, which is convenient on a workstation and a problem on a shared host.
Everything else about history flows through the line editor. The history search on CTRL-R is bash and zsh style, the UpArrow and DownArrow bindings above give prefix search, and the multi-line editing experience covers history as well as the current buffer, so a failed multi-line construct does not collapse into one unreadable line.
Undo and redo are part of the same editor, and the kill ring belongs to emacs mode. Taken together, these are the features that make long interactive sessions tolerable: a mistake three commands back is recoverable rather than something you retype from memory.
Because history is saved automatically, treat the saved history as sensitive on any machine you do not fully control.
Ctrl+Space menu completion is only somewhat like IntelliSense
This is the honest limit of the project inside a console window. Menu completion is described in the README as somewhat like IntelliSense, with selection by arrow keys, triggered by Ctrl+Space.
The same ceiling shapes the editing modes. Both cmd and emacs modes are usable but not complete, so a key sequence you expect from a terminal you use every day can simply be unbound or bound to something less capable.
A second practical failure mode is customisation drift. Every binding lives in a profile, and the sample profile file shipped with the module (SamplePSReadLineProfile.ps1) shows off a lot of handlers at once. Copy it wholesale and you have replaced defaults you never meant to touch.
Where PSReadLine stops and the editor host takes over
The alternatives are not competing readline implementations so much as different layers.
The difference in approach is direct. PSReadLine improves the console you already have and needs no editor.
Building PSReadLine from source needs .NET 6.0 or newer plus the InvokeBuild and platyPS modules, then build.ps1 with -Bootstrap, -Configuration Debug, or -Test with -Framework net472 on Windows or -Framework net6.0. Artifacts land in bin/Debug.
Licensed BSD-2-Clause. The last push was on 2026-10-19.
Editorial conclusion
Adopt PSReadLine if you write multi-line PowerShell by hand and want emacs bindings, history search and undo in the raw console. Skip it if your workflow depends on real completion intelligence inside the window, since the README itself calls Ctrl+Space menu completion only somewhat like IntelliSense, and pick an editor-backed host instead. Check one thing before you install anything: on Windows PowerShell 5.1, confirm that PowerShellGet reports 1.6.0 or higher, because the version that ships with it cannot install prerelease modules and your install command will fail for a reason that has nothing to do with PSReadLine.
Frequently asked questions
What does PSReadLine do?
It replaces the PowerShell command line editing experience for version 3 and up, adding syntax coloring, syntax error notification, multi-line editing, customizable key bindings, history search and undo.
How do I install PSReadLine?
Run Install-Module PSReadLine -Repository PSGallery -Scope CurrentUser -Force for the stable channel, adding -AllowPrerelease for the newest prerelease. Windows PowerShell 5.1 users must first update PowerShellGet to 1.6.0 or higher.
Where is PSReadLine installed on a system?
The documented install command uses -Scope CurrentUser, so the module lands in the current user's module path rather than the machine-wide one.
What is a PSReadLine psm1 file?
The README names SamplePSReadLineProfile.ps1, a profile file included with the module that holds many example key handler customisations. It is a script, not a binary module file.
Official sources
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.
[](https://hysenlabs.com/projects/powershell-psreadline)Star history chart for your README
[](https://hysenlabs.com/projects/powershell-psreadline)Was this useful?