CMD.EXE prompt batch file windows - title length

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 17030
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

CMD.EXE prompt batch file windows - title length

Post by ChrisGreaves »

Judging from a quick search, Win11 changed many aspects of the TITLE area, top-line of a CMD window. And yes, I know that I ought to advance from BATch files, but my investment is heavy and they have been getting the job done for hundreds (!) of years.

Code: Select all

:: In this version we set the day of week and then test to set device strings Y and Z
::		for /f %%a in ('wmic path win32_localtime get dayofweek /format:list ^| findstr "="') do (set %%a)
		if not %dayofweek%==0 goto 25Purging

		if exist Z:\nul goto 20MountedZ
		Title %0 -                     Mounting drive Z
%DEBUG%
		"C:\Program Files\VeraCrypt\VeraCrypt.exe" /q /l Z  /v %Z%
		%DEBUG%
echo Check drive Z mount 
In this snippet from a DOS backup batch file, I use the TITLE command to lodge text in the window. My Title is a fixed-format - the name of the batch file, and then the action being taken. Note the white-space in the title; I was raised on The Little Book of Basic StyleTo my surprise in Win11 the TITLE command seemed to produce no output at all. Well, hardly any output, as a Title:
Title01.png
So I wrote a test script

Code: Select all

title here is a title
pause
title %0 here is a title
pause
which produced the output as
Title03.png
Armed by new-found knowledge in this topic "getting rid of Win11 Notepad - reverting back to the no-tab version" which prompted me to click on the cog wheel icon in the top right, to get into Settings where I found
Title02.png
.
I changed the Tab Width Mode from "Equal" to "Title length", saved changes, and now see the complete Title. Hooray!

My current feeling is that there are/were many more changes to Notepad; this reinforces my belief that some change in the ap name, a version number at least, might have been helpful.
Note that I am now using the *new* **improved** ***all-singing-all-dancing*** version of Notepad and morosely wait now for the next feature to leap out and bite me in the bum.
Cheers, Chris
You do not have the required permissions to view the files attached to this post.
It is better to Aim High and Fail than to aim low and succeed.