XP: change the default directory of run->cmd

Kaldskryke

[H]ard|Gawd
Joined
Aug 1, 2004
Messages
1,346
Okay, so at home whenever I go Start->Run then type "cmd" to open a command shell, the directory defaults to 'C:\Documents and Settings\username\My Documents\' and that's annoying.
At work, the directory defaults to 'M:\' (a network drive I don't even use) - that's even more annoying.
I know it doesn't take a whole pile of work to type "cd" but since I keep a lot of my executable scripts and stuff in one folder, I'd like to change the default directory. I know that I could add a path to the PATH environment variable, but surely there's a better way. Is it a registry key I'm looking for, or something easier?
 
You could also install the "Command Here" Powertoy. Then, in Explorer, you simply right click on the folder you want to work in, and choose the "Command Prompt Here" option.
 
You can use the autorun feature of the command prompt, but it can cause problems if you you batch files.

HKCU\Software\Microsoft\Command Processor\Autorun

Create an Autorun string if it doesn't exist. In here, enter the command you want it to run every time you open CMD. So, to have it open to C:\, you would enter

Code:
cd /d c:\

But, any time you open a new command window it will run that command. So if you're running a batch file by clicking on it, or start CMD from within a batch file, it will execute that command first. It can cause some weird problems.

I use it to run initCMD.cmd and gives me the date/time and sets the colors the way I like them.
 
Back
Top