How to set the default directory of the cd command in Windows cmd terminal?

The command cd without any arguments simply displays the current directory; it doesn't "take you" anywhere.

From an already open command prompt, you can't change this using simply cd. You can write a batch file that does it for you, and run that instead. Create a plain text file with Notepad that contains just one line.

cd /d"C:\Users\Kacy\Documents"

Save it as MyDocs.bat or something that you can remember easily.

If you want a command prompt to always open in a certain location, create a desktop shortcut to it with the command (program)

cmd /k cd /d"Yourdirectory"

And then double-click that desktop shortcut to open the command prompt.

Note the double quotes around the directory name are necessary if the directory name includes spaces.


On Windows 10, you can also navigate to C:\Users\%YOUR_USERNAME%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools, then right click command prompt and select properties.

Then in the Shortcut tab, you can change the "Start in:" field to be whatever path you desire. By default it references Environment Variables, but you can update it to be C:, D:/My Folder/Foo/Bar, etc.


Steps to change default directory in Command Prompt in Windows 10:

  1. Click on Windows icon and search for "cmd".
  2. Once you see the file, right click on it and choose "Open File Location"
  3. You will land on a shortcut for cmd. Now right-click again and "Open File Location".
  4. Copy this location and go to Desktop.
  5. Right click on the desktop in empty space and go to "New -> Shortcut". Add the value of the path in the location box i.e. "your path\cmd.exe"
  6. Now you can see the shortcut on the desktop. Right click on it and choose "Shortcut" from the menu. Go to "Start in" field and update the path u want to open by default. Click Ok and you are done!

Tags:

Cmd

Cd

Windows 8