Changing default startup directory for command prompt in Windows 7

后端 未结 23 1986
情深已故
情深已故 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:04

    regedit worked great. HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\Command Processor, all you have to do is change the AutoRun key value, which is already set to wherever you are currently getting dumped into to a new value in the format of:

    cd /d <drive:path>
    
    for c:\, that would be cd /d c:\
    for junk, that would be cd d/ c:\junk
    

    its very simple, even a novice thats never used regedit should be able to figure it out. if not, go to the c:\prompt and just type in regedit, then follow the path to the key.

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

    This doesn't work for me. I've tried this both under Win7 64bit and Vista 32.

    I'm using the below commandline to add this capability.

    reg add "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v AutoRun /t REG_SZ /d "IF x"%COMSPEC%"==x%CMDCMDLINE% (cd /D c:)"

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

    Easiest way to do this

    1. Click "Start" and type "cmd" or "command prompt".
    2. Select Top most search application named exactly same "cmd" or "command prompt".
    3. Right Click on it and select "Send To"=>"Desktop".
    4. On Your Desktop New "cmd" Shortcut will appear
    5. Right Click on that icon and choose "properties"
    6. Popup will appear, In "Shortcut" Tab Type the new location in "Start In" option (e.g D:\xyz)
    7. Drag that icon and add/pin it in "Task Bar"
    0 讨论(0)
  • 2020-11-30 20:08

    Bit late but ignore the registry mods. Simply change the shortcut target to:

    cmd /k "command"
    

    i.e.

    cmd /k "cd\myStartUpFolder"
    

    Voila!

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

    "start in directory" command

    cmd /K cd C:\WorkSpace
    

    but if WorkSpace happens to be on different than C drive, console will be launched in default folder and then you still need to put D: to change drive To avoid this use cd with -d parameter

    cmd /K cd -d D:\WorkSpace
    

    create a shortcut and your fixed ;)

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

    One easy way to do it + bonus.

    Start cmd with administrator rights, the default directory for the prompt will be C:\WINDOWS\system32.

    I created a bat file in that directory (notes.bat) Opened it with notepad and wrote the following lines. Each line is followed with a comment which should not be added to the bat file.

    @echo off
    
    prompt $S$CYourNamel$F$S$G$S 
    /* This is a comment, do not include it in the bat file - above line will make the prompt look like  (YourName) > */
    
    cd C:\Your_favorite_directory
    /* This is a comment, do not include it in the bat file - above line will navigate you to your desired directory */
    

    Saved the file and that was it. Now when You open cmd with admin rights, just write: notes or notes.bat and it will execute the notes.bat file with desired changes.

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