Quick start: archiving files from the command line

WinRAR

Quick start: archiving files from the command line


The common command line syntax for archiving files is:

WinRAR A [ -switches ] <Archive> [ Files ] [ @File lists ]

For example, if you wish add the file LETTER.TXT to the archive LETTERS.RAR, type:

WinRAR A LETTERS.RAR LETTER.TXT

If an archive extension is not specified, WinRAR will use the default archive format selected in the default compression profile, but you may override it by specifying either .RAR or .ZIP extension.

The next example: add all *.WAV files to the solid RAR archive Songs:

WinRAR A -S Songs.RAR *.WAV

It is also possible to list the files to be archived in a file, rather than listing them in the command line. In this case the name of text file, containing the list of files to be archived, must be given in the command line. This is indicated by placing the symbol @ before this file name. Thus, you can create a file Binaries, containing the strings *.exe and *.com and execute the command:

WinRAR A TOOLS.ZIP @Binaries

to add all files with .EXE and .COM extensions from the current folder to ZIP archive TOOLS.

Window containing statistics is displayed during the archiving process. If you wish to break archiving, click on "Cancel" button in the command window. You may press "Background" button in this window to minimize WinRAR to the tray. If archiving is completed without problems, WinRAR terminates. Diagnostic message window is displayed in case of error.

See Command-line interface for detailed descriptions of commands and switches.