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 Promp
regedit worked great. HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\Command
Processor, all you have to do is change the AutoRun key value, which is already set to wherever you are currently getting dumped into to a new value in the format of:
cd /d <drive:path>
for c:\, that would be cd /d c:\
for junk, that would be cd d/ c:\junk
its very simple, even a novice thats never used regedit should be able to figure it out. if not, go to the c:\prompt and just type in regedit, then follow the path to the key.
This doesn't work for me. I've tried this both under Win7 64bit and Vista 32.
I'm using the below commandline to add this capability.
reg add "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v AutoRun /t REG_SZ /d "IF x"%COMSPEC%"==x%CMDCMDLINE% (cd /D c:)"
Bit late but ignore the registry mods. Simply change the shortcut target to:
cmd /k "command"
i.e.
cmd /k "cd\myStartUpFolder"
Voila!
"start in directory" command
cmd /K cd C:\WorkSpace
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
cmd /K cd -d D:\WorkSpace
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 be C:\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.
@echo off
prompt $S$CYourNamel$F$S$G$S
/* This is a comment, do not include it in the bat file - above line will make the prompt look like (YourName) > */
cd C:\Your_favorite_directory
/* This is a comment, do not include it in the bat file - above line will navigate you to your desired directory */
Saved the file and that was it.
Now when You open cmd
with admin rights, just write: notes
or notes.bat
and it will execute the notes.bat
file with desired changes.