Changing default startup directory for command prompt in Windows 7

后端 未结 23 1984
情深已故
情深已故 2020-11-30 19:50

How do I change default startup directory for command prompt in Windows 7?

I usually do the following to start command prompt from C:\\

  WIN-R (Run Promp         


        
相关标签:
23条回答
  • 2020-11-30 19:59

    My default dir was system32 when starting CMD. I then created a batch file in that directory to change dir to the one I was after.

    This caused me to always call that bat when starting CMD every time. So I made a reg file & put this inside:

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
    "Autorun"="cd C:\\Users\\Me\\SomeFolder"
    
    

    After saving it, I opened the file, clicked ok to merge with registry, and since then every time I open CMD, I get my dir

    0 讨论(0)
  • 2020-11-30 19:59

    hi if you want cmd to automatically open when the machine starts up you can place the cmd.exe executable in the startup folder(just search for startup and place a shortcut of cmd.exe there)

    0 讨论(0)
  • 2020-11-30 20:00

    Make a shortcut pointing to cmd.exe somwhere (e.g. desktop) then right-click on the copy and select "properties". Navigate to the "Shortcut" menu and change the "Start in:" directory.

    0 讨论(0)
  • 2020-11-30 20:00

    Edit: It actually seems that editing the file shortcut breaks the Win+x, c key shortcut. (Moral of the story: only change system files you know how to fix! Eventually after a Windows update it repaired itself.)

    What I ended up doing is creating a new customized Command Prompt shortcut in the start folder and pinned to the taskbar that I launch instead of cmd.exe


    As other answers point out, changing the registry Autorun cmd start location is a bad idea because it silently will break other programs that shell out for tasks, like Visual Studio Code.

    You should just change whatever shortcut you use to open cmd to have a Start In entry.

    If you use Win+x, c to launch cmd, you can edit the Start In for

    "%LOCALAPPDATA%\Microsoft\Windows\WinX\Group3\02 - Command Prompt.lnk"
    
    0 讨论(0)
  • 2020-11-30 20:01

    On Windows Start Menu, right click on Command Prompt.

    Click on "Properties".

    "Command Prompt Properties" dialog box opens.

    Edit the field "Start in " to a location where you want to start the command prompt.

    Example: Chand %HOMEDRIVE%%HOMEPATH% to D:\PersonalPrograms.

    Next time when you start command prompt the start up directory will be D:\PersonalPrograms

    0 讨论(0)
  • The following solution worked well for me. Navigate to the command prompt shortcut in the start menu:

    C:\Users\ your username \AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Command Prompt

    Right click on the shortcut file to open the properties dialog. Inside the "Start in:" textbox you should see %HOMEDRIVE%%HOMEPATH%. If you want the prompt to start in C:\ just replace the variables with "C:\" (without quotes).

    update

    It appears that Microsoft has changed this behavior recently and so now an additional step is required. After performing the steps above copy the modified shortcut "Command Prompt" and rename it to "cmd". Then when typing "cmd" in the start menu it should once again work.

    0 讨论(0)
提交回复
热议问题