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 d
AFAIK you can't do an if else in batch like you can in other languages, it has to be nested if's.
Using nested if's your batch would look like
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%"
)
)
)
)
or as James suggested, chain your if's, however I think the proper syntax is
IF %F%==1 IF %C%==1(
::copying the file c to d
copy "%sourceFile%" "%destinationFile%"
)