Take Title of your CLI

If you have batch files that require a long time to run or would like to have an easy way to monitor the progress, here’s an easy way. By using the TITLE command, you can change the title of the command prompt window. When you minimize the window to the task bar, the title bar is displayed. If you change the title as your script progresses you can easily monitor it’s progress.

Setting the text for the title bar is as simple as:

c:\> title Working…Please Wait

Here’s a more practical example. Using FILEVER I can get some very specific version information about executables on my system. What I want is a space delimited file that I can open in Excel for further analysis and sorting. As you might imagine, this task might take a while to run. By using TITLE, I can modify the title bar to indicate what file the script is working on:

@echo off
::EXEVer.bat
::Create a space delimited file of all EXE files with version
::information from running FILEVER.EXE

set log=exeversions.log
REM clear the log file if it already exists
if exist %log% DEL %log% >NUL

Title Working…
REM Build the file listing and use TITLE to display the status
for /f “tokens=*” %%x in (‘dir c:\*.exe /s /b’) do @CALL :GetInfo “%%x”

Title Finished %0
Echo Results logged to %log%
Start Notepad %log%
set log=

GOTO :EOF

:GetInfo
Title Analyzing %1
for /f “tokens=*” %%v in (‘filever %1’) do @echo %1  %%v >>%log%

:EOF

Unfortunately, the command window will retain the last title set so you’ll want to set it back to something like Windows Command Prompt when your script is finished if you are keeping the window open.

Do you have any creative uses for TITLE?  If so, I’d love to hear about them.