Change to default start folder for Windows command prompt

11,822

Solution 1

The command prompt automatically starts in the Home Directory specified in your user profile.

A "workaround" to avoid messing with scripts and such is to create a new shortcut to cmd.exe.

  • Create a new shortcut to %systemroot%\system32\cmd.exe
  • Once the shortcut is created, right-click and select Properties
  • In the Shortcut tab, set the "Start in" field to the path you want to start in, ie, C:\foo\bar\Something Else
  • Click OK and try your new shortcut!

Solution 2

First method : Execute a change-directory command when cmd starts

From "How to change the default startup directory for Command Prompt?":

Click Start, Run, and type Regedit.exe.
Navigate to the following branch:

HKEY_CURRENT_USER\Software\Microsoft\Command Processor

On Windows 10 update 1909, the key is rather in the following location. No reboot is required.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

In the right-pane, double-click Autorun and set the startup folder path as its data, preceded by "CD /d ".
If Autorun value is missing, you need to create it, of type String in the above location.

Example: To set the startup directory to F:\Windows, set the Autorun value data to "CD /d F:\Windows".

Second method : Change user's home folder

Right-click "My computer" and choose Manage.
Select "Local users and Groups" and then Users.
Double-click the user in question and go to the Profile tab.
Set in "Home folder" the required directory as the value of "Local path" and do OK.

Solution 3

You can create a desktop shortcut with: cmd /k cd "Initial folder path" and use it to open command prompt in that specific folders.

Share:
11,822

Related videos on Youtube

bhaskar
Author by

bhaskar

Former Community Manager at Stack Exchange (August 2013-November 2017). My posts from before or after that time period (and, like, a bunch of the ones from during it, too) should not be considered "official" in any way. Joel: I have all these opinions ... and no outlet for them! Josh: Have you tried yelling them at the Internet? Joel: Almost exclusively! And yet problems still persist! -"The Grand Opining", HijiNKS ENSUE, by Joel Watson "On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question." -Charles Babbage Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law. -Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid

Updated on September 17, 2022

Comments

  • bhaskar
    bhaskar over 1 year

    My new Windows XP work computer's command prompt automatically brings up "H:\>" when I open it. Is there a way for me to change that safely? Specifically, to "C:\foo\bar\Something Else"? I found the method of changing the Autorun value through Google, but it came with a warning that it "might affect the functionality of batch scripts."

    Bonus note: I was originally getting at this issue in this question, but I didn't ask very directly. The answer I ended up accepting was really good, so I wanted to leave it there.

  • yoshco
    yoshco over 10 years
    you need to logoff and back for changes to take effect, thanks for the tip.
  • Craig Wilcox
    Craig Wilcox over 3 years
    This is THE answer; trust me.