If you use PowerShell often, a title bar of your own will make a powerful impression. You certainly have noticed that my screenshots always show the entire console window and you also may have noticed that I have customized my title bar.
If you have no clue what I’m talking about take a look at my console title bar shown below.
Cool stuff ha? Now we will define a title for your console window together. Let’s start.
1. PowerShell Profile ($profile)
First of all, it’s worth to mention that the content of the standard console window title bar is modified every time you start PowerShell. It’s not permanent and it has to be configured per user. For customizing the title bar we need a PowerShell profile file. If you already have one, the following command returns true.
If it returns false, create a profile file with the one-liner below. The command will create a new profile file in the users directory.
New-Item $PROFILE -ItemType File -Force
2. Execution Policy
There’s one more thing we gotta do before we can start. We have to check the execution policy status. The PowerShell execution policy is designed to prevent unintentional and accidental code execution of ps1 files. To allow the execution of our previously configured profile file we have to take a look at the status of the execution policy of the local computer.
If the command returns Restricted, we have to change the status to RemoteSigned or Unrestricted (not recommended).
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Now we are ready for the main part. Please double check the prerequisites.
- Did you configure the profile file? ==> Test-Path $profile
- Did you check the Execution Policy? ==> Get-ExecutionPolicy
Customizing the PowerShell Title Bar
Now we have reached the main part of this blog post. In a few minutes your PowerShell window title bar will be equipped with your own style.
In PowerShell run the command ise $profile. This should open your profile file in PowerShell ISE.
Copy the code below to line 1.
Now, customize the content of “YOUR TITLE” to suit your needs.
For example, the file might look like this:
@Off Topic: In addition, I always set the execution location to C:. That is more pleasant than C:\Users … And further, I clear the screen with Clear Host.
Now save the file and close PowerShell ISE.
We’re done. Now close and reopen PowerShell.
If you want to use special characters, use the type [char].
This leads to the following title bar.
To explore all characters see https://www.rapidtables.com/code/text/unicode-characters.html
Have fun with your new PowerShell title bar.
More about PowerShell Profiles here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-6