Changing default startup directory for command prompt in Windows 7

后端 未结 23 1985
情深已故
情深已故 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 20:16

    While adding a AutoRun entry to HKEY_CURRENT_USER\Software\Microsoft\Command Processor like Shinnok's answer is the way to go it can also really mess things up, you really should try to detect a simple cmd.exe startup vs a script/program using cmd.exe as a child process:

    IF /I x"%COMSPEC%"==x%CMDCMDLINE% (cd /D c:\)
    
    0 讨论(0)
  • 2020-11-30 20:16

    type

    cmd.exe /k cd c:/
    

    in a text file and save as cmd.bat Clicking this file does the trick. You can pin it to the start menu as well.

    To start in a partitioned drive (e.g. D), use

    cmd.exe /k d:
    
    0 讨论(0)
  • 2020-11-30 20:17

    On windows 7:

    1. Do a search for "cmd" on your Windows computer
      1. right-click cmd and left click "Pin to start menu" (Alternatively, right-click cmd - click copy and then paste to your desktop )
      2. right-click the cmd in your start menu or on your desktop (depending on choice 2 above) - left click properties
      3. inside the "start in" text box paste the location of your default start directory
      4. Press Apply and OK

    Every time you click on the cmd in your start menu or your desktop shortcut, the CMD will open in your default location

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

    Open regedit and browse to this path

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor
    

    Create new string vale named Autorun. Set its value to cd /d C:\.

    Run cmd again. Voila!

    0 讨论(0)
  • 2020-11-30 20:18
    1. go to regedit ( go to search and type regedit)
    2. expand "HKEY_CURRENT_USER" node
    3. under HKEY_CURRENT_USER node expand "software" node
    4. under software node expand "microsoft" node
    5. under microsoft node click on "Command Processor"
    6. path looks like this : "HKEY_CURRENT_USER\Software\Microsoft\Command Processor"

    it looks something like this :

    1. if you do not see "Autorun" String Value
    2. Right Click - New - Expandable String Value, and rename it to Autorun
    3. double click on "Autorun" 10.enter this value path format:
    4. "CD/d C:\yourfoldername\yoursubfoldername"
    0 讨论(0)
  • 2020-11-30 20:18

    In the new Windows Terminal, you can click Settings and edit the line "startingDirectory" to achieve something similar.

    Please note, however, that this changes the default startup directory only in Windows Terminal, and not for the command prompt globally.

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