I have a question about if - else structure in a batch file. Each command runs individually, but I couldn't use "if - else" blocks safely so these parts of my programme doesn't work. How can I do make these parts run? Thank you.
IF %F%==1 IF %C%==1 (
::copying the file c to d
copy "%sourceFile%" "%destinationFile%"
)
ELSE IF %F%==1 IF %C%==0 (
::moving the file c to d
move "%sourceFile%" "%destinationFile%"
)
ELSE IF %F%==0 IF %C%==1 (
::copying a directory c from d, /s: bo? olanlar hari?, /e:bo? olanlar dahil
xcopy "%sourceCopyDirectory%" "%destinationCopyDirectory%" /s/e
)
ELSE IF %F%==0 IF %C%==0 (
::moving a directory
xcopy /E "%sourceMoveDirectory%" "%destinationMoveDirectory%"
rd /s /q "%sourceMoveDirectory%"
)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…