WinRAR is
Windows version of the RAR archiver - a powerful tool which allows you
to create, manage and control archive files. There are several versions of RAR,
for a number of operating environments: Windows,
Linux, FreeBSD, DOS, OS/2,
MacOS X.
There
are two versions of RAR for
Windows:
- Version with graphical user interface
- WinRAR.exe;
- Command line console (text mode) version
- Rar.exe.
WinRAR features
- Complete support of RAR and ZIP 2.0 archives;
- Highly sophisticated, original
compression algorithm;
- Special algorithms optimized
for text, audio, graphics, 32-bit and 64-bit Intel executable compression;
- Shell interface
including drag-and-drop
facility and wizard;
- Command line interface;
- Non RAR archives (7Z, ACE, ARJ, BZ2, CAB, GZ, ISO, JAR, LZH, TAR, UUE, Z ) management;
- Solid archiving,
which can raise compression ratio by 10% - 50% over more common methods,
particularly when packing a large number of small, similar files;
- Multivolume archives;
- Creation of self-extracting
archives (also multivolume) using the default or optional SFX modules;
- Recovering physically
damaged archives;
- Recovery volumes
allowing to reconstructing missing parts of multivolume archives.
- Unicode support in file names;
- Other service functions, such
as encryption, archive comments, error logging, etc.
Command line syntax
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 denoted function to be performed by WinRAR |
Switch | Switches used to define a specific type of operation, compression strength, type of archive, etc. |
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 c:\work\image\*.bmp//backup pictures c:\work\misc 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. |
Notes
a) If neither files nor listfiles are specified, then *.* is implied and WinRAR will process all files;
b) If archive extension is not specified, WinRAR will use the default archive format selected in the default compression profile, but you may override it specifying either .RAR or .ZIP extension;
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.
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
Also it is possible to
list the files to be archived in a file, rather than listing them on the
command line. In this case the name of the file, containing the list of files
to be archived, must be given on the command line. This is indicated by placing
the symbol @ before this file name. Thus, if you create a file, Binaries,
containing the strings *.exe and *.com, then execute the command:
WinRAR A TOOLS.ZIP
@Binaries
all files with .EXE and
.COM extensions from the current folder will be added to the ZIP archive
TOOLS.
During the archiving
process, a window, containing statistics, will be displayed. If you wish to
break the archiving process, click on the Cancel button in the command
window. You may press the "Background" button in this window to
minimize WinRAR to the tray. If archiving is completed, without problems,
WinRAR will terminate. In case of an error, a Diagnostic message window will
be displayed.
Quick start: extracting files from the command line
Common command line syntax to extract files with full paths:
WinRAR X [ -switches ] <Archive> [ Files ] [ @File
lists ] [ Destination folder\ ]
To extract files, ignoring paths:
WinRAR E [ -switches ] <Archive> [ Files ] [ @File
lists ] [ Destination folder\ ]
For example if you wish extract the file LETTER.TXT to the
current folder from the archive
LETTERS.RAR, use the following command:
WinRAR X LETTERS.RAR LETTER.TXT
Archive extension is optional and may be omitted.
The next command extracts all *.WAV files from the archive Songs
to the folder Audio:
WinRAR X Songs *.WAV Audio\
It is also possible to list the files to be extracted in a
file, rather than listing them on the command line. In this case the name of
the file, containing the list of files to be archived, must be given on the command
line. This is indicated by placing the symbol @ before this file name. Thus, if
you create a file, Binaries, containing the strings *.exe and *.com, execute
the command:
WinRAR X TOOLS @Binaries
all files with EXE and COM extensions from the archive TOOLS
will be extracted to the current folder.
During the extraction process, a window containing
statistics, will be displayed. If you wish to break the extraction process,
click on the Cancel button in the command window. You may press the
"Background" button in this window to minimize WinRAR to the tray. If
extraction is completed, without problems, WinRAR will terminate, in the case
of an error, a Diagnostic message window will be displayed.
Steps for Archiving specified file :
- Open Command Prompt
- Type the following command :-
- c:\> <Path\winrar.exe> a < path/filename1> < path/filename2>
- Path\winrar.exe = Path where winrar is installed in your system
- a = command for archiving
- path/filename1 = Location and name you want generate for archiving
- path/filename2 = Location and name of the file(s) you wants to archive.
- for example = C:\>"C:\Program Files\WinRAR\WinRAR.exe" a c:\test\archive_file.rar c:\test\text_file.txt