In this article, you will know how to change the default directory of command prompt in 3 ways.
When you open command prompt in any version of Windows, the default directory is either set to C:\Windows\System32 or C:\Users\<user name>.
If you want to change the default directory of the command prompt to some other folder, here are 3 simple steps to do so.
Steps to change the default directory of command prompt:
Changing the default path of cmd is very simple and some steps may not work when you open the command prompt as administrator. In the below 3 ways that I have shared, the default path of cmd will be changed no matter if you have opened cmd in administrative mode.
1. Change the Start-in path of cmd:
- Search for command prompt in Windows search. Right-click and open file location.
- Right-click on the Command Prompt shortcut and open the properties. Change the ‘Start in‘ field under the Shortcut tab as shown below and click OK.
- Verify by opening the command prompt again and the path is changed.
Note: This way of changing the default directory works only when you open the command prompt in normal mode. But this does not work if the command prompt is opened as administrator.
Read also: [Full Tutorial] Metadrive – A must-have Google Drive Add-on
2. Change the Target folder of the command prompt:
- Open the command prompt shortcut location as described in way #1.
- This change the Target path to
%windir%\system32\cmd.exe /k "cd C:\"
- If your new path is in C drive (where the Windows is installed), then set the below path.
In my case, my target path is C:\TechSupportWhale
%windir%\system32\cmd.exe /k "cd C:\TechSupportWhale"
- If your desired directory path is in a different drive, then you must update the path as below.
In this case, my target directory is in E drive (not C drive where Windows is installed).
%windir%\system32\cmd.exe /k "cd E:\TechSupportWhale & E:"
This will change the default directory path in command prompt when run as administrator.
3. Through registry editor:
Though updating the default cmd path in registry is a simple step, we do not recommend to do so unless you have not followed point #2.
- Open registry editor by typing regedit in Windows search bar and press Enter.
- Go to path
- Selecting the Command Processor folder, create a new “String Value” with the name Autorun by Edit → New → String Value.
- Double click on the newly created Autorun and update the value data to
cd /d E:\TechSupportWhale
That’s all it takes to change the default directory in the Windows command prompt. The first two ways are quite simpler and that should give you the desired result. But if there is any challenge, go for updating the registry.
If you are not confident about the registry changes, take a backup of the registry first before making any changes. In case there are any issues, you can revert the changes.
I hope the post provided the answer that you were looking for. Cheers !!!
6 thoughts on “How to Change the Default Directory of Command Prompt in Windows 10/11”
Exactly what I was looking for. Thanks!
Thanks, exactly what I needed.
Thanks for the post!
excellent and very clear working instruction.
The registry editor method worked for me, as I open command prompt through Win+R and cmd. Though the Command Processor entry was nonexistant in HKEY_CURRENT_USER, it was present under HKEY_LOCAL_MACHINE so I added the new string value there. Adding it there worked (and without a restart too).
Option 3 worked. Thanks 🙏