Track current location in PowerShell Title Bar

CLIs or Command-line interfaces are great tools but can become difficult to use when you are buried deep into the file system.  The prompt becomes so long that your commands begin to wrap onto additional lines making it hard to identify errors.

However, with PowerShell you can move the current location into the title bar leaving your command prompt nice and neat.

To do this simply create a PowerShell profile.ps1 file that contains the following line:

   function Prompt{ $host.ui.rawui.windowtitle = "$pwd" }

Place this file in the %UserProfile%\My Documents\WindowsPowerShell\ folder and the next time you start PowerShell your prompt will remain PS> regardless of the folder you navigate too.

You can read more about PowerShell Profiles here.

Below is a profile.ps1 file you can use.

profile.ps1 (57.00 bytes)

Comments are closed