Change the title text displayed across the top of the CMD terminal window.
Syntax TITLE [string] Key string The title for the command prompt window, up to 243 characters.
The TITLE command is typically used in a batch file to give the script window a meaningful name.
The default title for the CMD shell is %comspec% however, the title can be re-defined in a program shortcut, so when opened from the Start Menu, the title is often set to "Command Prompt". The START command, used to start a program in a separate window also has an option to specify a title for the new Window.
When the TITLE is set to %comspec% then starting a second CMD shell, or PowerShell, will add the name of the sub-shell to the Title: 'cmd.exe - cmd' or 'cmd.exe - powershell'.
When you EXIT back to the previous shell, the Title will revert making it possible to track how many nested shells you have open.
If you call a batch script in a new CMD session, then any TITLE set within the batch file will revert when the second CMD session ends.
TITLE Some initial title text CMD /c MyBatchFile.cmd ...
TITLE is an internal command so it is not available within PowerShell.
In PowerShell the Windows Title may be accessed from $host.ui.RawUI
Change the title to "A demo title":
$host.ui.RawUI.WindowTitle = "A demo title"
A prompt function that will change the title to the current location (via JSnover),
To make this permanent, save the function to your PowerShell $Profile:function Prompt {
$host.ui.RawUI.WindowTitle = $(get-location)
"PS> "
}
Set a title for the current session:
C:\> title Remember, all I’m offering is the truth. Nothing more
Set the default %comspec% title:
C:\> title %comspec%
In a batch file, set the title to match the name of the batch file with:
@Echo off
TITLE %~nx0
“The longer the title, the less important the job” ~ George McGovern.
MODE - change the size of the CMD window.
COLOR - change the colour of the CMD window.
PROMPT - change the CMD window prompt.
START - start a program in a separate window.
Max length of the TITLE command - windevcluster forum.
QuickEdit mode - also changes the title (temporarily).
Equivalent PowerShell: Set the console title to current working dir (s.