Shorten the Prompt

by Feb 26, 2015

PowerShell 3.0 and later

By default, PowerShell includes the current path into the prompt, and when you launch PowerShell as regular user, the current location is your user profile. That is a long path, and it is eating a lot of space.

The most effective and easiest approach would be to simply change the current directory to the root directory:

 
PS C:\Users\Tobias\Documents> cd \

PS C:\>  
 

Or, you adjust the prompt function, and make sure it displays the current location elsewhere, for example in the title bar:

function prompt
{
  'PS> '
  $host.UI.RawUI.WindowTitle = Get-Location
}

Twitter This Tip! ReTweet this Tip!