Using multiple IF statements in a batch file

后端 未结 5 2008
情深已故
情深已故 2021-02-01 07:28

When using more than 1 IF statement, is there a special guideline that should be followed? Should they be grouped? Should I use parenthesis to wrap the command(s)?

An ex

5条回答
  •  囚心锁ツ
    2021-02-01 07:46

    You can structurize your batch file by using goto

    IF EXIST somefile.txt goto somefileexists
    goto exit
    
    :somefileexists
    IF EXIST someotherfile.txt SET var=...
    
    :exit
    

提交回复
热议问题