How do I add a Title to a powershell window?

I have many PowerShell windows open, with a command history specific for a task.

In the good old Batch file days I would use Title finance dpt or Title Email Admin. How can I accomplish this in PS?


Solution 1:

PS C:\> $Host.UI.RawUI.WindowTitle = "New Window Title"

You can also throw this in your profile if it's something you want on each new PS window.

Check out the TechNet article Customizing the Windows PowerShell Console

Solution 2:

If you want to set the title when you spawn a process:

$StartInfo = new-object System.Diagnostics.ProcessStartInfo
$StartInfo.FileName = "$pshome\powershell.exe"
$StartInfo.Arguments = "-NoExit -Command `$Host.UI.RawUI.WindowTitle=`'Your Title Here`'"
[System.Diagnostics.Process]::Start($StartInfo)

Solution 3:

The simplest way of doing this is to use the following command in the PowerShell window:-

$host.ui.RawUI.WindowTitle = 'Some Name'

You can also use the following command in the Command prompt(cmd) or RunAs Dialog Box for getting the PowerShell Window with desired Title in the traditional CMD styled window.

cmd /k PowerShell -NoExit -Command "& {$host.ui.RawUI.WindowTitle = 'Powershell'}"

P.S: Its like traditional CMD with PowerShell features and Syntax Highlighting.