<http://www.netikka.net/tsneti/info/tscmd172.htm>
Copyright © 2003-2010 by Prof. Timo Salmi  
Last modified Wed 5-May-2010 07:25:31

 
Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index
 

This page is edited from the 1cmdfaq.txt faq-file contained in my tscmd.zip command line interface (CLI) collection. That zipped file has much additional material, including a number of detached .cmd script files. It is recommended that you also get the zipped version as a companion.

Please see "The Description and the Index page" for the conditions of usage and other such information.



172} How to change and restore the title bar text of the command prompt?

Setting the window title for the command prompt window in a script is straight-forward:
@echo off & setlocal enableextensions
title A title for the command prompt window
endlocal & goto :EOF


So far, so good. But what if we wish only a temporary title for the duration of running a script?
@echo off & setlocal enableextensions
cmd /c title A transient caption
rem Next do whatever
echo Take a look at the title bar
rem Wait for a moment
ping -n 5 127.0.0.1>nul
endlocal & goto :EOF




There is another option, but you'll the have to call the script with cmd /k sciptname and terminate afterwards with exit.
@echo off & setlocal enableextensions
title A transient title
rem Next do whatever
echo Take a look at the title bar
endlocal & goto :EOF



/c "Carries out the command specified by string and then terminates"
/k "Carries out the command specified by string but remains"

The START command has similar connotations, but it is covered in another item.

References/Comments:
  hh ntcmds.chm::/cmd.htm
  hh ntcmds.chm::/start.htm
  hh ntcmds.chm::/title.htm