It is possible to perform WinRAR commands from the command line. Common command line syntax is described below:
WinRAR <command> -<switch1> -<switchN> <archive> <files...> <@listfiles...> <path_to_extract\>
|Command||Character combination specifying the function to be performed by WinRAR. See the list of WinRAR commands here.|
|Switch||Switches are used to define a specific type of operation, compression strength, type of archive, etc. See the list of WinRAR switches here.|
|Archive||The name of the archive to process.|
|Files||The name(s) of files to be processed.|
|Listfiles||Listfiles are plain text files that contain names of
files to process. File names should start at the first column. It is
possible to put comments to the listfile after // characters. For example,
you may create backup.lst containing the following strings:
c:\work\doc\*.txt//backup text documents
and then run:
winrar a backup @backup.lst
You may specify both usual file names and list files in the same command line.
|Path_to_extract||Used only with commands e and x, indicating the folder in which to place extracted files. If this folder does not exist, it will be created.|
a) If neither files nor listfiles are specified, then *.* is implied and WinRAR will process all files;
b) If archive extension is not specified when creating an archive, 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.
If no archive extension is specified when extracting, WinRAR assumes .rar, so * means all archives with .rar extension. If you need to process all archives without extension, use *. mask. *.* mask selects all files. You can use wildcards in archive name in most operations, such as extraction, test and many others, but wildcards are not allowed when archiving and deleting.
c) Switches entered on the command line override the same configuration settings;
d) For commands c, e, s, t, rr, k and x wildcards may be used in the archive name. Thus it is possible to process more than one archive with a single command. Moreover, if you specify -r switch with these commands, they will search for archives in subfolders;
e) Some commands and switches are applicable only to RAR archives, some both to RAR and ZIP and some to all archive formats. This is dependent upon the functionality provided by the archive format;
f) Commands and switches are not case sensitive, you may write them both in upper and in lower case;
g) If any component of command line contains spaces, enclose it to quotes.
- add the folder "c:\latest data" to archive Info.rar
WinRAR a Info.rar "c:\latest data"
- unpack the archive Info.rar to folder d:\data
WinRAR x Info.rar d:\data\