Today I Learned How To Enable Tab Completion in PowerShell
March 08, 2020
I have always been envious at seeing bash users being able to use tab completion. It makes CLI work much more convenient and slick. Today, I found out how to enable that in PowerShell (specifically in the new PowerShell Core).
This is the command to enable this feature:
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
This will only be temporary; it will only affect the currently opened PowerShell session.
Making It Permanent
In order to make this permanent, this needs to be placed in a profile file. The file is
C:\Users\<user>\Documents\PowerShell\Microsoft.PowerShell_profile.ps1. If you have not done any customization before, this file will not exist.
To create the profile file, you need to run the following command:
new-item $profile -itemtype file -force
After creating the file, open it and just add the tab completion command inside and save. Your next opened PowerShell session will automatically run the commands in the profile file.
The steps listed are for PowerShell Core. If you are using the old non-Core version (ie. version 1.0 to 5.1), Follow the steps as described in the Source link below.