This post contains the instructions to enable PowerShell TAB completion as an menu. Sort of like it works in Linux Bash. Normally TAB cycles through the commands.
You can also TAB for options and values. See pictures below:

Solution

To enable this perform the following powershell command: Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete

How to make solution permanent

The only caveat is you have to run this command everytime you start a PowerShell window. To make this a permanent solution we have to create a PowerShell profile

Step 1) Check if a profile already is present

If a profile already is present we have to add this to the profile, otherwise the profile have to be created. To check: Test-Path $Profile

PS C:\Users\edwin> Test-Path $Profile
False
PS C:\Users\edwin>

If it states False no profile is present

Step 2) Create a profile

To create a profile: New-Item –Path $Profile –Type File -Force

PS C:\Users\edwin> New-Item –Path $Profile –Type File -Force

    Directory: C:\Users\edwin\Documents\PowerShell

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          07/10/2021    12:35              0 Microsoft.PowerShell_profile.ps1

PS C:\Users\edwin>

Step 3) Edit the profile

Simply use notepad to edit the profile: notepad $Profile
And add the line Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete to the profile

Now safe and close the file and restart PowerShell.

Note

Please be aware that if you use PowerShell 5.x (Default in Windows 10/11) and PowerShell 7.x you have to implement this for both environments

That’s it. If you have usefull additions to your PowerShell Profile and you feel like sharing, please let me know in the comments below!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.