Start WinRAR, click in menu Help on first menu item Help topics, expand on help tab Contents the list item Command line mode and
- read the help page Command line syntax,
- expand the list item Commands and read the help page Alphabetic commands list and
- expand the list item Switches and read the help page Alphabetic switches list.
Then you know how I created this single command line below and what all those switches mean.
"%ProgramFiles%\WinRAR\WinRAR.exe" a -ac -ao -afzip -agYYYY-MM-DD_NN -cfg- -ed -ep1 -ibck -inul -m5 -r -y -- "D:\Backup Folder\DataBackup_.zip" "C:\Path To Folder With Files To Backup\"
See also answer on Simply compress 1 folder in batch with WinRAR command line?
WinRAR adds to ZIP archive only files with archive attribute set because of switch -ao
and clears the archive attribute after compressing the file into the archive because of -ac
. The archive attribute is automatically set by Windows when a file is modified, renamed or moved. So this command line avoids compressing the same unmodified files again and again into ZIP archives.
The ZIP file is named automatically with current date in name and an automatic incremented number in case of this command line is executed multiple times on one day.