Use this.
doskey cd=cd/d $* $T for /d ^%A in (.) do @title ^%~nxA
Hello all,
I would like to have the command window the name of the current folder (I often have multiple ones open / on the taskbar). For that I've got a
command replacement like this :
doskey cd=cd /d $* ^&^& d:\owncmds\dos\SetTitle.bat
with "SetTitle.bat" being
For %%F in ("%CD%") do Set Title %%~nxF
(The "For" construct because it cannot seem to apply "~nx" on an environment variable)
This works.
I would like to get rid of the "SetTitle" batchfile though. The problem
with that is when I replace the calling of that batchfile with its contents (and change "%CD%" to "%%CD%%") the name of the command window will show the folder I just left, instead of the folder I've moved into.
Does anyone have an idea how to fix this ?
Regards,
Rudy Wieser
Use this....
doskey cd=cd/d $* $T for /d ^%A in (.) do @title ^%~nxA
Apparently, DOSKEY's `$T` special code caused the macro to somehow
emit an extra ENTER key (WTH).
Replace it with `^&` instead, just like in your original code. i.e.
Hello all,
I would like to have the command window the name of the current folder (I often have multiple ones open / on the taskbar). For that I've got a
command replacement like this :
doskey cd=cd /d $* ^&^& d:\owncmds\dos\SetTitle.bat
with "SetTitle.bat" being
For %%F in ("%CD%") do Set Title %%~nxF
(The "For" construct because it cannot seem to apply "~nx" on an environment variable)
This works.
I would like to get rid of the "SetTitle" batchfile though. The problem
with that is when I replace the calling of that batchfile with its contents (and change "%CD%" to "%%CD%%") the name of the command window will show the folder I just left, instead of the folder I've moved into.
Does anyone have an idea how to fix this ?
That was discussed a few weeks ago in alt.msdos.batch.nt
set dd=cd&doskey cd=cd $* ^&call title %^%dd^%%
Herbert,
That was discussed a few weeks ago in alt.msdos.batch.nt
Thank you. I've taken a peek into that newsgroup and found the thread.
set dd=cd&doskey cd=cd $* ^&call title %^%dd^%%
Hmmm... Are you sure that will work ? I mean, the "set dd=cd" part isn't stored by doskey ...
As a check I put the above in a batchfile,
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 481 |
Nodes: | 16 (2 / 14) |
Uptime: | 27:14:11 |
Calls: | 9,543 |
Calls today: | 3 |
Files: | 13,656 |
Messages: | 6,140,474 |