Set-PSReadLineOption

Deep Dive into Set-PSReadLineOption: Customize Your PowerShell Editing Experience

Welcome back to Wahman’s PowerShell blog! Today, we’re going to explore a very handy command that lets you take more control over how PowerShell behaves in the console: Set-PSReadLineOption.

Description (From Microsoft Docs):
Set-PSReadLineOption customizes the behavior of command line editing in PSReadLine.

This cmdlet allows you to personalize your PowerShell session—everything from syntax highlighting to edit modes and bell styles can be tweaked to suit your preferences. Whether you’re a beginner or a seasoned PowerShell user, this cmdlet can significantly improve your development experience.

Example 1: Change Console Edit Mode (Beginner)

By default, PowerShell uses the Emacs-style key bindings. You can switch to Windows or Vi modes if you’re more comfortable with those.

Set-PSReadLineOption -EditMode Windows

This command changes the editing mode to Windows-style, making it feel more familiar to users coming from Command Prompt.

Example 2: Disable the Annoying Bell Sound (Intermediate)

Ever get annoyed by the console bell ringing when you press a wrong key combo? You can make it silent.

Set-PSReadLineOption -BellStyle None

This will suppress the bell sound, offering a quieter coding environment.

Example 3: Customize Syntax Highlighting Colors (Intermediate)

Let’s make your PowerShell console more visually appealing or improve readability. Here’s how to change the color of strings to Cyan:

Set-PSReadLineOption -TokenKindColors @{ String = [ConsoleColor]::Cyan }

You can customize other token kinds similarly, such as Command, Parameter, Variable, etc.

Example 4: Make PowerShell More Script-Friendly with Vi Mode (Advanced)

For users coming from a Unix or Linux background, Vi-style command mode can be very useful.

Set-PSReadLineOption -EditMode Vi

This enables Vi editing behavior in the PowerShell console. Press Esc to enter command mode and i to go back into insert mode.


As you can see, Set-PSReadLineOption opens up a world of customization for your PowerShell experience. From small quality-of-life improvements to completely changing how you interact with your console, this cmdlet is worth adding to your PowerShell toolbox.

Happy scripting, and I will see you in the next post!

Leave a Reply

Your email address will not be published. Required fields are marked *