Posted on April 6, 2016 · Posted in Powershell

PSReadLine – useful Powershell module

In Windows 10 PowerShell has got a lot of new features, some of which are offered by PSReadLine module. PSReadLine is a third-party PowerShell module that allows to expand PowerShell command line experience. This module makes using the console easier and more comfortable.

You can display the information about this module with the following command:

Get-Module PSReadLine | fl

Get-Module PSReadLine


PSReadLine has a number of useful features like syntax highlighting and warning of the errors when typing commands. Thus, in the example below a quotation mark is omitted, and the module highlights it.

powershell syntax highlighting

The module also has the autosuggestion feature. For instance, enter Get-Process command and press Ctrl+Space, then using the arrow keys select the proper option from the menu and press Enter. It is very convenient especially if you don’t remember the exact parameter names.

powershell auto suggestion

If you have to enter a multiline command, you can use Shift+Enter, which starts a new line to continue entering the command. Notably, you can easily navigate between the lines and edit the text located in different lines.

powershell multiline

The command history is worthy of special mention. In fact, PowerShell has its own command history, but PSReadLine saves its history of commands, which is convenient to search. Search is made using Ctrl+R (search backwards) and Ctrl+S (search forward). To search, just press the proper key combination and enter a part of the command in the search line.

Especially notably, the command history is saved as a text file and can be used in different sessions, other than the current one.

powershell history search


The most of PSReadLine features can be configured. As an example, let’s display the list of parameters responsible for command history:

Get-PSReadlineOption | fl *history*

Now let’s take HystoryNoDuplicates that excludes duplicate commands from the history. By default, it is disabled. Enable it with the following command:

Set-PSReadlineOption -HistoryNoDuplicates


The key combinations are customizable. You can see the current combinations using Get-PSReadlineKeyHandler and change them using Set-PSReadlineKeyHandler


For example, let’s assign going to the beginning of the history to Ctrl+Q and going to the end of history to Ctrl+W:

Set-PSReadlineKeyHandler -Key ^Q -Function BeginningOfHistory

Set-PSReadlineKeyHandler -Key ^W -Function EndOfHistory

Now press Ctrl+Q and get the first of the entered commands.


In Windows 10 PSReadLine module is already installed in the system, but you have to install it separately in other Windows versions. You can do it in several ways. The most convenient way is to install it from PowerShell repository using PowerShellGet module (earlier known as OneGet). PowerShellGet is included into PowerShell v5 and Windows Management Framework 5, and for earlier PowerShell versions (v3 и v4) it can be downloaded and installed separately.

PowerShellGet allows to download and install the module using one simple command Install-Module PSReadLine. Moreover, you can also update this module to its latest version using Update-Module command.

As an alternative, PSReadLine can be installed from GitHub, using a third-party PsGet module, or downloading and extracting it into the folder with other modules manually. But, as the module developer says, this method is not recommended, since the module won’t be updated in GitHub and can even be removed from it in future.

Related Articles