open command prompt window and change current working directory

后端 未结 7 840
时光说笑
时光说笑 2021-02-01 14:16

I\'m terribly new to scripting on windows. Using windows 7 64.

I\'m trying to make a .bat file that I can double click, and have it open a command prompt and automatical

7条回答
  •  情歌与酒
    2021-02-01 15:01

    Use the /K switch:

    @ECHO OFF
    start cmd.exe /K "cd C:\my\destination"
    

    But IMHO, the most useful switch is /?.

    Starts a new instance of the Windows XP command interpreter
    
    CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
        [[/S] [/C | /K] string]
    
    /C      Carries out the command specified by string and then terminates
    /K      Carries out the command specified by string but remains
    /S      Modifies the treatment of string after /C or /K (see below)
    /Q      Turns echo off
    ...
    

    And only if it does not work, then Google it, as @Neeraj suggested :D

提交回复
热议问题