Useful DosKey + Command window titles

Useful DosKey + Command window titles

  • Comments 5

Mark got me mucking with my doskey macros again, and between the two of us came up with a fairly elegant mechanism that keeps the title of a command line reflecting the current directory you're in:

First, you need a little script turd that does this:

@%*
@title %CD% - %OTHER_STUFF_YOU_MIGHT_WANT_IN_YOUR_TITLE%

I named that script 'ttl.cmd' and stick it in my %SCRIPTS% directory.  Then, my doskey macro file that I run for command windows that I open contains this:

cd..=%SCRIPTS%\ttl cd ..
cd=%SCRIPTS%\ttl cd /D $*
pushd=%SCRIPTS%\ttl pushd $*
popd=%SCRIPTS%\ttl popd $*
a:=%SCRIPTS%\ttl a:
b:=%SCRIPTS%\ttl b:
c:=%SCRIPTS%\ttl c:
d:=%SCRIPTS%\ttl d:
e:=%SCRIPTS%\ttl e:
f:=%SCRIPTS%\ttl f:
g:=%SCRIPTS%\ttl g:
h:=%SCRIPTS%\ttl h:
i:=%SCRIPTS%\ttl i:
j:=%SCRIPTS%\ttl j:
k:=%SCRIPTS%\ttl k:
l:=%SCRIPTS%\ttl l:
m:=%SCRIPTS%\ttl m:
n:=%SCRIPTS%\ttl n:
o:=%SCRIPTS%\ttl o:
p:=%SCRIPTS%\ttl p:
q:=%SCRIPTS%\ttl q:
r:=%SCRIPTS%\ttl r:
s:=%SCRIPTS%\ttl s:
t:=%SCRIPTS%\ttl t:
u:=%SCRIPTS%\ttl u:
v:=%SCRIPTS%\ttl v:
w:=%SCRIPTS%\ttl w:
x:=%SCRIPTS%\ttl x:
y:=%SCRIPTS%\ttl y:
z:=%SCRIPTS%\ttl z:

And now you get the command window title to track the directory that you're currently located in. The only gotcha is that you can't do <space>cd foo because that prevents doskey macros from running.

-Kev

Leave a Comment
  • Please add 7 and 8 and type the answer here:
  • Post
  • Nice one ..thanks...
  • This is great.

    We should also mention that, if something goes awry, you can always just run ttl.cmd manually to fix things (assuming %SCRIPTS% is in your path).
  • FreiK,

    Do known if there is any public documentation regarding "@" usage? I couldn't find any using searches. Thanks.
  • @ is basically a way to prevent the command from echoing, even if echo is on. I can't find any docs on it in the help...
  • Regarding @, invoke the help:

    c:\>HH NTCMDS.CHM

    Find the help for the 'echo' command. See the Remarks.
Page 1 of 1 (5 items)