No matter what %dow% is, the IF statement is evaluating as true. I even echo %dow% at the end to confirm that it's getting set properly and it does seem to be.
Code: Select all
@ECHO OFF
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET Today=%%B
FOR /F "TOKENS=*" %%A IN ('TIME/T') DO SET Now=%%A
set month=%Today:~0,2%
set day=%Today:~3,2%
set year=%Today:~6,4%
set hour=%Now:~0,2%
set minute=%Now:~3,2%
set amPm=%Now:~6,2%
ROBOCOPY "C:\Program Files (x86)\sugarcrm-6.1.3\\" "\\linkstation\sugarBackup\dailyBackup\\" /MIR /COPY:DT /FFT /LOG+:"C:\Users\*****\Work\Sugar Batch File\logs\sugarBackupLog"%year%%month%%day%%amPm%%hour%%minute%".txt"
FOR /f %%a in ('date /t') do set dow=%%a
if %dow%=="Sat" goto SAT else goto END
::Also tried if %dow%==Sat and got the same results.
:SAT
ROBOCOPY "C:\Program Files (x86)\sugarcrm-6.1.3\mysql\data\mysql\\" "\\linkstation\sugarBackup\weeklyBackup\savedMysql"%year%%month%%day%%amPm%%hour%%minute%"\\" /MIR /COPY:DT /FFT /LOG+:"C:\Users\*****\Work\Sugar Batch File\logs\saved\mysqlBackupLog"%year%%month%%day%%amPm%%hour%%minute%".txt"
ROBOCOPY "C:\Program Files (x86)\sugarcrm-6.1.3\mysql\data\sugarcrm\\" "\\linkstation\sugarBackup\weeklyBackup\savedSugar"%year%%month%%day%%amPm%%hour%%minute%"\\" /MIR /COPY:DT /FFT /LOG+:"C:\Users\*****\Work\Sugar Batch File\logs\saved\sugarBackupLog"%year%%month%%day%%amPm%%hour%%minute%".txt"
echo. %dow%
pause
:END
I appreciate any help. Thanks!