1

I often find myself end up with several cmd windows which I need to be open for several days at a time.

When I hover on the clumped cmd icon in task bar (in windows 7), it shows me something like this (see screenshot below):

How it looks on my task bar

All those CMDs have different current directory. I always have to do a hit-and-trial to restore every window to find the one where I want to work. If after restoring, its not the intended one, then I minimize it and restore next. Rinse and repeat. Its quite counter-productive.

What I would prefer is that instead of useless information like "Administrator: C:\Windows\system32\cmd.exe", it should show the current duirectory that cmd is in.

Is there a way do achieve this?

bits
  • 205

2 Answers2

4

Within the command window, use the TITLE command.

Syntax
  TITLE [string]

Key
  string  The title for the command prompt window, up to 243 characters.
Kruug
  • 5,250
1

You can make the Command Prompt change its title whenever the working directory changes.

For example, to achieve this when using cd to change directories, define the following macro

doskey cd=cd C:\cd.bat $*

and create a batch file (C:\cd.bat) containing the following:

@echo off

cd %*

title %cd%

If you write similar files for pushd and popd (just replace cd), you can create a batch file (e.g., C:\macros.bat) that sets the title to the current location and defines macros for cd, pushd, popd and the X: command:

@echo off

title %cd%

doskey cd=C:\cd.bat $*
doskey popd=C:\popd.bat $*
doskey pushd=C:\pushd.bat $* 

for %%b in (A B C D E F G H I J K L M N O P Q R S T U V V X Y Z) do @doskey %%b:=C:\cd.bat /D %%b:

To get a Command Prompt with these macros, either invoke it like this:

cmd /K C:\macros.bat

or create a String value with Name AutoRun and Data C:\macros.bat in the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
Dennis
  • 50,701