PCbanter

PCbanter (http://www.pcbanter.net/index.php)
-   General XP issues or comments (http://www.pcbanter.net/forumdisplay.php?f=18)
-   -   Changing the caption of a DOS box to the name of the current folder - a problem (http://www.pcbanter.net/showthread.php?t=1108755)

R.Wieser August 28th 19 07:14 PM

Changing the caption of a DOS box to the name of the current folder - a problem
 
Hello all,

A few weeks ago I got a bit fed up with having several minimized
command-prompt windows on my taskbar, and all displaying the same "command
prompt" caption text. So, I googled for a solution (duh).

What I found is the program "title", with which the "idle" caption of the
window can be set. As I start a batch file to open such a command prompt
(which gets the path to the folder in %1) I just added the line "title %~n1"
to set the caption to the name of the current folder.

The problem ofcourse is that when I execute a "cd" the caption doesn't
change to match the new folder. :-(

Does anyone know if the "title" program (or another /that comes with the
OS/) can be told to track the current folders name ?

Regards,
Rudy Wieser

Remark: If no program exists I will probably try to make one myself: I don't
think that the result will be pretty though (polling & updating
command-prompt windows every 100...1000 ms or so. yuck)




Thun Clatrilly August 30th 19 09:12 AM

Changing the caption of a DOS box to the name of the current folder - a problem
 
R.Wieser writes:

A few weeks ago I got a bit fed up with having several minimized
command-prompt windows on my taskbar, and all displaying the same "command
prompt" caption text. So, I googled for a solution (duh).

What I found is the program "title", with which the "idle" caption of the
window can be set. As I start a batch file to open such a command prompt
(which gets the path to the folder in %1) I just added the line "title %~n1"
to set the caption to the name of the current folder.

The problem ofcourse is that when I execute a "cd" the caption doesn't
change to match the new folder. :-(

Does anyone know if the "title" program (or another /that comes with the
OS/) can be told to track the current folders name ?

Regards,
Rudy Wieser



May I humbly offer this pathway to your goal?

1. Kindly create a BAT file which changes the caption to match the
name of the current folder, wherever that might to be.

==========================================
@Setlocal ENABLEEXTENSIONS
@Echo OFF
Set CAPTION=%CD%
For %%F in ("%CD%") do (
Set CAPTION=%%~nxF
)
Title %CAPTION%
==========================================

2. Then kindly use the Windows DOSKEY command to redefine the CD
commandas a macro. The macro shall first execute the build-in CD
with parameters to change the folder. The macro shall then execute
the BAT file to set the caption to the name of the new current
folder.



R.Wieser August 31st 19 09:05 AM

Changing the caption of a DOS box to the name of the current folder - a problem
 
Thun,

May I humbly offer this pathway to your goal?


You certainly may. :-) And thank you for doing so.

Though the thing is that I mentioned "cd" as an example. There are more
ways to change the current directory (including inside (batch) programs),
and I hoped to catch them all with a single method.

1. Kindly create a BAT file which changes the caption to
match the name of the current folder


Am I wrong, or does that batchfile not actually change the current directory
? whistle :-)

Regards,
Rudy Wieser



R.Wieser August 31st 19 08:36 PM

Changing the caption of a DOS box to the name of the current folder - a problem
 
Thun,

Am I wrong, or does that batchfile not actually change the current
directory ? whistle :-)


2. The macro shall first execute the build-in CD with parameters to
change the folder. The macro shall then execute the BAT file


Whoops, I missed that part. Sorry.

I also found the following page, showing different implementations of what
you suggested:
https://superuser.com/questions/1433...-in-windows-xp

Regards,
Rudy Wieser




All times are GMT +1. The time now is 10:46 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2004 - 2006 PCbanter
Comments are property of their posters