How do I change default startup directory for command prompt in Windows 7?
I usually do the following to start command prompt from C:\
WIN-R (Run Prompt) cmd /K cd C:\
I want to do the following to start command prompt from C:\
WIN-R (Run Prompt) cmd
Edit: It actually seems that editing the file shortcut breaks the key shortcut. (Moral of the story: only change system files you know how to fix!)
As other answers point out, changing the registry Autorun cmd start location is a bad idea because it silently will break other programs that shell out for tasks, like Visual Studio Code.
You should just change whatever shortcut you use to open cmd to have a Start In entry.
If you use Win+x, c to launch cmd, you can edit the Start In for
Easiest way to do this
Bit late but ignore the registry mods. Simply change the shortcut target to:
i.e.
Voila!
"start in directory" command
but if WorkSpace happens to be on different than C drive, console will be launched in default folder and then you still need to put D: to change drive To avoid this use cd with -d parameter
create a shortcut and your fixed ;)
One easy way to do it + bonus.
Start
cmd
with administrator rights, the default directory for the prompt will beC:\WINDOWS\system32
.I created a bat file in that directory (
notes.bat
) Opened it with notepad and wrote the following lines. Each line is followed with a comment which should not be added to the bat file.Saved the file and that was it. Now when You open
cmd
with admin rights, just write:notes
ornotes.bat
and it will execute thenotes.bat
file with desired changes.The following solution worked well for me. Navigate to the command prompt shortcut in the start menu:
C:\Users\ your username \AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Command Prompt
Right click on the shortcut file to open the properties dialog. Inside the "Start in:" textbox you should see %HOMEDRIVE%%HOMEPATH%. If you want the prompt to start in C:\ just replace the variables with "C:\" (without quotes).
update
It appears that Microsoft has changed this behavior recently and so now an additional step is required. After performing the steps above copy the modified shortcut "Command Prompt" and rename it to "cmd". Then when typing "cmd" in the start menu it should once again work.