views:

810

answers:

6

When I open cmd on my laptop it is defaulting to the F: drive. This is troubling me does anyone know how it got that way or how to get it back to where it opens to the C: drive by default?

A: 

quick answer: cmd /k c:

long answer to make it "automagical": http://windowsxp.mvps.org/autoruncmd.htm

DrFloyd5
A: 

I believe it defaults to %HOMEDRIVE%\%HOMEPATH% so if you can muck about with those environment variables that might be an option. I can't edit these environment variables on my company's network, so I had to use the AutoRun to change it to something sane.

OwenP
Changing %HOMEDRIVE% might have unexpected effects
Colin Pickard
A: 

If you are opening it from a shortcut change the working dir for the shortcut.

EBGreen
A: 

In addition to the other answers, there's a nice powertoy for XP called "open command window here." It adds an option to your right-click context menu when you click inside a folder to open a command window using that directory as the starting path.

http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx

Neil Neyman
A: 

I ran into a similar issue where cmd would always open up in a particular directory (annoying when running scripts which invoke cmd). The best way to deal with this is to edit your autorun settings. Raymond Chen has a nice article about this here: http://blogs.msdn.com/oldnewthing/archive/2007/11/21/6447771.aspx

The summary is that when you start a command shell, it checks the autorun registry key, and executes the commands stored there. The registry keys it checks are:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
    and/or
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
tsellon