Discussion:
Batch command to put the file name in the Window header bar
(too old to reply)
Wade Garrett
2023-02-08 18:51:02 UTC
Permalink
If I write a batch file to do something out of batch commands, how do I get
that batch file to put in the Windows header bar the name of that file?

Is there an "output to the window title" command in Windows batch language?
--
My wife asked me to take her to one of those restaurants where they make
the food right in front of you. So I took her to Subway...and that¢s how
the fight started.
Andy Burns
2023-02-08 19:21:29 UTC
Permalink
Post by Wade Garrett
If I write a batch file to do something out of batch commands, how do I get
that batch file to put in the Windows header bar the name of that file?
Is there an "output to the window title" command in Windows batch language?
only at the time you start the batch, not afterwards.
Zaidy036
2023-02-08 21:11:17 UTC
Permalink
Post by Andy Burns
Post by Wade Garrett
If I write a batch file to do something out of batch commands, how do I get
that batch file to put in the Windows header bar the name of that file?
Is there an "output to the window title" command in Windows batch language?
only at the time you start the batch, not afterwards.
the TITLE command changes the title of the current window at anytime
while the batch is running.
JJ
2023-02-08 22:22:27 UTC
Permalink
Post by Zaidy036
Post by Andy Burns
Post by Wade Garrett
If I write a batch file to do something out of batch commands, how do I get
that batch file to put in the Windows header bar the name of that file?
Is there an "output to the window title" command in Windows batch language?
only at the time you start the batch, not afterwards.
the TITLE command changes the title of the current window at anytime
while the batch is running.
The annoying thing about the TITLE command is that, there's no way to
restore the original title back, after it has been changed.
Char Jackson
2023-02-09 00:23:28 UTC
Permalink
Post by JJ
Post by Zaidy036
Post by Andy Burns
Post by Wade Garrett
If I write a batch file to do something out of batch commands, how do I get
that batch file to put in the Windows header bar the name of that file?
Is there an "output to the window title" command in Windows batch language?
only at the time you start the batch, not afterwards.
the TITLE command changes the title of the current window at anytime
while the batch is running.
The annoying thing about the TITLE command is that, there's no way to
restore the original title back, after it has been changed.
Can you store it in a string variable, so that you can set it back to
the original value later?
Wade Garrett
2023-02-09 01:05:50 UTC
Permalink
Post by Char Jackson
Post by JJ
Post by Zaidy036
the TITLE command changes the title of the current window at anytime
while the batch is running.
The annoying thing about the TITLE command is that, there's no way to
restore the original title back, after it has been changed.
Can you store it in a string variable, so that you can set it back to
the original value later?
What's needed is that string variable to get the file name because the file
name changes depending on the use, and then save it into that variable.

Something like this pseudo code

set TITLE=getfilename(current batch file name)
--
Maybe I was raised wrong, but I was taught if you wanted something,
you worked for it.
Kerr-Mudd, John
2023-02-09 10:02:53 UTC
Permalink
On Wed, 8 Feb 2023 20:05:50 -0500
Post by Wade Garrett
Post by Char Jackson
Post by JJ
Post by Zaidy036
the TITLE command changes the title of the current window at anytime
while the batch is running.
The annoying thing about the TITLE command is that, there's no way to
restore the original title back, after it has been changed.
Can you store it in a string variable, so that you can set it back to
the original value later?
What's needed is that string variable to get the file name because the file
name changes depending on the use, and then save it into that variable.
Something like this pseudo code
set TITLE=getfilename(current batch file name)
/That/'s easy:
title %0

Otherwise yes, set a string var:

set mytitle="Have a Nice Day"
rem set
title %mytitle%
pause
rem change
title temporary title
pause
rem restore
title %mytitle%

but yes, AFAICT there's no way to pick up the current title string.
--
Bah, and indeed Humbug.
Zaidy036
2023-02-09 02:06:41 UTC
Permalink
Post by JJ
Post by Zaidy036
Post by Andy Burns
Post by Wade Garrett
If I write a batch file to do something out of batch commands, how do I get
that batch file to put in the Windows header bar the name of that file?
Is there an "output to the window title" command in Windows batch language?
only at the time you start the batch, not afterwards.
the TITLE command changes the title of the current window at anytime
while the batch is running.
The annoying thing about the TITLE command is that, there's no way to
restore the original title back, after it has been changed.
what would be the purpose?
You may issue the TITLE as many times as you would like. I have a batch
that at start sets a title (.xyz.bat) to differentiate it from the bat
file itself (_xyz.bat) and then near the end of the batch sets a new
Title (0) so that the batch can run a second time without interference
to the first CMD window which stays open. I have a %1 variable to
position the CMD windows so they do not overlap using Nirsoft's
Multimonitortool
Stan Brown
2023-02-09 15:40:26 UTC
Permalink
Post by Zaidy036
Post by Andy Burns
Post by Wade Garrett
If I write a batch file to do something out of batch commands,
how do I get that batch file to put in the Windows header bar
the name of that file?
Is there an "output to the window title" command in Windows batch language?
only at the time you start the batch, not afterwards.
the TITLE command changes the title of the current window at anytime
while the batch is running.
Wow - I thought I was pretty good with CMD, but that's a new one on
me. It works in both native Windows CMD and TCC/LE. Thanks!
--
Stan Brown, Tehachapi, California, USA https://BrownMath.com/
Shikata ga nai...
Philip Herlihy
2023-02-10 12:37:32 UTC
Permalink
In article <***@news.individual.net>, Stan Brown
wrote...
Post by Stan Brown
Post by Zaidy036
Post by Andy Burns
Post by Wade Garrett
If I write a batch file to do something out of batch commands,
how do I get that batch file to put in the Windows header bar
the name of that file?
Is there an "output to the window title" command in Windows batch language?
only at the time you start the batch, not afterwards.
the TITLE command changes the title of the current window at anytime
while the batch is running.
Wow - I thought I was pretty good with CMD, but that's a new one on
me. It works in both native Windows CMD and TCC/LE. Thanks!
One thing you could do is start a new command interpreter instance, using the
CMD command. Set the TITLE in that, and it's visible in the title bar, but
when you EXIT the layered instance, the original title is visible again.
Post by Stan Brown
TITLE First
CMD
TITLE Second
EXIT
.. obviously you'd include other commands, depending on what you wanted to do.
--
Phil, London
Loading...