Changing default startup directory for command prompt in Windows 7

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

提交回复
热议问题