How do I add a Title to a powershell window?
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
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.
Solution 3
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)
Related videos on Youtube
Juanjo Daza
Updated on September 18, 2022Comments
-
Juanjo Daza 2 monthsI 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 dptorTitle Email Admin. How can I accomplish this in PS?-
Admin over 1 year@buzz3791 The UserVoice.com link in comment from '18 is no longer available. Can you delete the comment? We can't edit your comment.
-