Page 1 of 1
Set the default working directory for a command prompt.
Posted: Fri Nov 08, 2013 10:29 am
by jasonb
1. Run regedit and navigate to HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor.
2. Add the string "Autorun" and give it the value "cd /d C:\Directory" (replace this with the actual path).
Re: Set the default working directory for a command prompt.
Posted: Fri Nov 15, 2013 9:30 am
by jasonb
A side effect of this is batch files. If you've set a default working directory for cmd.exe, batch files will use that as their working directory, rather than the directory where the batch file is located. To override this in the case of a particular batch file, add the following command at the top:
cd /d "%~dp0"
This changes directories to the location of the batch file itself - which is its first called parameter.