Whenever you open the Command Prompt in Windows you are taken to a default directory which is usually your /Documents and Setting/Username/ directory or /users/username/ directory in newer versions of the Windows operating system.
Most of the time you navigate away from it because you need to access files that cannot be accessed from there, or only by adding the full path of it to the query which is not that practicable.
You can change the default command prompt directory, the directory that you start in when you open the prompt using the following tip. I have set mine to c:\windows\system32 but it is up to you which directory you select as the default command prompt directory on your system.
The change requires you to modify a value in the Registry. To do so press the Windows and R key at the same time to open up the run box on the system. Type in regedit and tap on the enter key on the keyboard to load the Registry Editor. You may receive an UAC prompt on newer versions of the operating system which you need to accept before the Registry Editor opens up.
Navigate to the key HKEY_CURRENT_USER\Software\Microsoft\Command Processor and search for the String Autorun in the right window.If you can't find the parameter there right-click on Command Processor and select New > String. Name the string Autorun and click ok. Now double-click the new Autorun entry that you find on the right and enter the following string.
CD /d c:\windows\system32
Replace c:\windows\system32 with the path that you want the command prompt to start in. The changes take effect immediately after you have made them in the Registry Editor. I suggest you keep the editor open and open a command prompt window to see if the new path is showing up when you do so. The easiest way to do so is to press Windows-R, type cmd and hit enter on the keyboard. If something turns out to be wrong, go back to the editor and verify or change the path information there.
It makes sense to pick a directory that you run commands from regularly and that is not set as a system environment variable or user variable.Advertisement
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.