I am using the below commands in windows batch file to rar a backup file in the C:\temp
folder.
I don't know why is not working and is not showing any errors
ECHO OFF
for /f %%a in ('date /t') do set DAY=%%a
SET rarFile=C:\temp\DATA%DAY%Backup.rar
echo
"C:\Program Files\WinRAR\Rar" a -r -df %rarFile% C:\temp\*Backup.bak
Maybe replace /
to _
and also let's use set correctly for directory paths with possible whitespace:
@echo off
for /f %%a in ('date /t') do set "DAY=%%a"
set "DAY=%DAY:/=_%"
set "rarFile=C:\temp\DATA%DAY%Backup.rar"
echo "C:\Program Files\WinRAR\Rar" a -r -df "%rarFile%" "C:\temp\*Backup.bak"
pause
This will only echo
the command for now, so once you are happy it works, remove echo
from the last line.