BAT file to open CMD in current directory

前端 未结 17 1950
清酒与你
清酒与你 2020-12-22 18:09

I have many scripts which I interact with from the command line. Everytime I need to use them, I have to open a command line window and copy+paste and CD to the path to the

17条回答
  •  一整个雨季
    2020-12-22 18:38

    I'm thinking that if you are creating a batch script that relies on the Current Directory being set to the folder that contains the batch file, that you are setting yourself up for trouble when you try to execute the batch file using a fully qualified path as you would from a scheduler.

    Better to add this line to your batch file too:

    REM Change Current Directory to the location of this batch file 
    CD /D %~dp0
    

    unless you are fully qualifying all of your paths.

提交回复
热议问题