How to Change the Default Directory of Command Prompt in Windows 10

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.

Open file location of command prompt

• 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.

Change the default directory in command prompt in Windows 10

• Verify by opening the command prompt again and the path is changed.

Update default path in command prompt

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.

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:\"

Change default path in cmd

Note:

  • 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 Computer\HKEY_CURRENT_USER\Software\Microsoft\Command Processor
  • 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
Change default directory of command prompt in registry

Source: https://techsupportwhale.com/change-default-directory-in-command-prompt/

Leave a Comment

Your email address will not be published. Required fields are marked *