Search code examples
windows-8cmdcd

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


The cmd command cd takes me to a directory I never spend any time in.

I would like it to take me to C:\Users\Kacy\Documents\ by default.

Unfortunately, set cd = C:\Users\Kacy\Documents\ does not work.

Is there a simple way to change this setting within the cmd terminal ?


Solution

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