RAR command line syntax
~~~~~~~~~~~~~~
grammar
RAR < command > [-<; Switch >] <; Compress files > [<; @ List file ... >]
RAR < command > [<; File ... >] [<; Decompression path \>]
describe
Command line options (commands and switches) provide control methods for creating and managing compressed files using RAR. life
A command is a string (or a single letter) that instructs the RAR to perform the corresponding operation. Switches are used for
Change the way RAR performs operations. Other parameters are the compressed file name and the compressed file or the file to be compressed.
Unzip the file to.
The list file is a plain text file containing the process file name. The first column should start with the file name. can
Add a comment after the//character. For example, you can create backup.lst using the following string:
C:\work\doc\*。 Txt // backup text document.
C:\work\image\*。 Bmp // back up the picture.
c:\work\misc
Then run:
rar a backup @backup.lst
If you want to read file names from standard input devices, please specify an empty file list name (@ only).
The Win32 console RAR uses OEM (DOS) encoding in the list file.
You can specify a common file name and a list file on the same command line. If files and lists
No file is specified, then RAR will default to *. * Processing all documents.
In UNIX environment variables, you need to put wildcards in quotation marks to avoid being extended by the shell. For example,
This command will extract all *. The asm file is from the RAR compressed file in the current path:
rar e '*。 rar' '*。' asm '
This command can be one of the following:
Add a file to a compressed file.
Example:
Create or update an existing compressed file myarch, and add all files in the current directory.
rar a myarch
Add a compressed file comment. Comments are displayed when processing compressed files. The comment length limit of the file.
The system is 32767 bytes.
Example:
rar c distrib.rar
You can also add comments from the file:
Rar c -zinfo.txt virtual
Cf add file comments. Show file comments when using the "v" command. The comment length of the file is limited to
32767 bytes.
Example:
Bigach *. Textfile (textfile)
Cw writes compressed file comments to the specified file.
Example:
rar cw oldarch comment.txt
Delete the file from the compressed file. Note that if this command causes all files in the file to be compressed.
Delete all, this empty compressed file will be deleted.
Unzip the file to the current directory.
Update files in compressed files. Update files that have changed since they were packaged into compressed files. This order does not
Add a new file to the compressed file.
I[I | c | h | t]= & lt; String >
Find a string in a compressed file.
The following optional parameters are supported:
I- case insensitive (default);
C- case-sensitive search;
H- hexadecimal search;
T- Use ANSI, Unicode and OEM character tables (only Win32 is available);
If no parameters are specified, I can use the simplified command-line syntax I Laidai.
For I =
It allows you to specify a "t" variable with another parameter, for example, ict= string mentioned above.
And perform a case-sensitive search in all tables in.
Example:
1) rar "IC = first stage" -r c:\*. rar *。 Textfile (textfile)
Perform a case-sensitive "first level" in *. Txt file in c:\*. Rar compressed files.
String search
2)rar ih = f 0 e 0 aeeaab 2d 83 E3 a 9-r e:\ text
Search for hexadecimal strings in the rar compressed file in the e:\text directory.
f0 e0 ae ae ab 2d 83 e3 a9 .
Lock the compressed file. Any command that attempts to change the compressed file will be ignored.
Example:
rar k final.rar
L[t, b] compressed file content list [technical information]. Use the' v' command to list files except.
File path. That is, only the file name is displayed. Optional technical information when using "T" correction (main operation
System, entity tags and old version tags). The variable "b" forces RAR to output only simple
File name, without any additional information.
Move to a compressed file [for files only]. Moving files and directories will be completed after the compression operation is completed.
Children are deleted. If the correction "f" is used and/or the switch "-ed" is applied, the directory will not be deleted.
Print files to a standard output device.
You can use this command with the -inul switch to disable all RAR information only.
Print file data. This may be important when you need to send files to a standard output device.
R repair the compressed file. The compressed file repair is completed in two stages. First, in the damaged compression
Find the recovery record in the file (refer to the "rr" command). If the compressed file contains recovery records, and
The corrupted data part is continuous and less than N*5 12 bytes (where n is the compressed file recovery block).
The probability of successfully recovering compressed files is very high. When this stage is completed, a new one
The compressed file will be created with the name of _ recover.rar.
If the damaged compressed file does not contain recovery records, or the compressed file is not fully recovered, it will lead to a large
Injury, the second stage will be executed. At this stage, only the structure of the compressed file is rebuilt, instead of
Files that fail CRC check can be recovered. Because the file is knotted, it is still possible to recover the undamaged file.
Structural damage. This is usually useful for non-physical compressed files.
When the second stage is completed, the compressed file of the reconstructed structure will be saved as rebuilt.arcname.rar.
The location of "arcname" is the original compressed file name.
The RAR/DOS32 version uses _recover.rar and _reconst.rar instead of the two mentioned above.
Name.
In the process of restoring records, when suspicious files are found, RAR can prompt users.
Suspicious item
Name:;
Size: After compression:;
Supplement: Yes/No/All
Answer "y" to add this item to the file _ recover.rar.
Example:
rar r buggy.rar
Rc uses the recovery volume (. Rev file) to rebuild the lost volume. You need to designate any existing volumes as.
Compress the file name, for example, "rarrc backup.part03.rar"
Read the "rv" command description for information about recovering the volume.
Rn renames compressed files.
The command syntax is:
rar rn <。 Compressed file name > < source file name1< & lt target file name1>; ...< source file name N>& lt eyes.
Tag file name N>
For example, the following command:
data.rar readme . txt readme . bak info . txt info . bak
In the compressed file data.rar, readme.txt will be renamed as readme.bak, and.
Info.txt changed its name to info.bak
You can simply change the file extension by using wildcards in the source file and the target file name.
Call transformation. For example:
Royal Navy of data.rar. txt *。 bak
All *. The txt file will be renamed to *.bak.
RAR does not check whether the target file name already exists in the compressed file, so you need to be careful to prevent it.
Duplicate names This is especially important when using wildcards. Due to an error, this order is potentially dangerous.
The wrong wildcard will damage all compressed file names.
Add a data recovery record. Optionally, redundant information (recovery records) can be added to the compressed file.
Medium. This will result in a slight increase in the compressed file size, but it may be lost in floppy disk errors or other data.
Help restore compressed files just in case. A recovery record contains at most 524,288 recovery blocks.
The number of blocks can be directly specified in "RR" (n =1,2) ... 524288) or there is no user.
Specify, but automatically set according to the size of the compressed file: the size of the recovery message is about the total size.
1% of the compressed file size, usually allowing recovery of consecutive numbers accounting for at most 0.6% of the total compressed file size.
According to.
You can also specify the recovery record size as a percentage of the compressed file size. Just add% to.
Command parameters. For example:
rar rr3% arcname
Please note that if you download from. bat or. Cmd file, which needs to be generated with rr3%%.
For rr3%, because the batch command takes the symbol "%"as the parameter at the beginning of the batch file. you can
Replace'%' with' p' so that' rr3p' can also run.
If the damaged data is continuous, each recovery record block helps to recover 5 12 pieces of damaged information.
If there are multiple corruptions, the value will be reduced.
The size of the recovery record can be calculated by the following formula:/256+<; Number of records recovered > *5 12
Byte estimation.
Rv[N] Create a recovery volume (. Rev file), which can be used later to reconstruct the lost files in the volume group. this life
To be sensitive to multi-volume compressed files, you need to specify the file name of the first volume file in the group.
For example:
Rar rv3 data.part01.rar
This feature can be used for backup, for example, sending multi-volume compressed files to a new group.
Some recipients did not receive some documents. Resending the recovery volume instead of the normal volume may
Reduce the total number of transferred files.
Each recovery volume can rebuild the lost RAR volume. For example, if you have 30 volumes and 3 volumes.
Copy a volume, and you can create any 3 lost volumes. If the number of. Rev file is less than the missing volume.
No.6, reconstruction will be impossible. The total number of normal volumes and recovery volumes cannot exceed 255.
Option
Attach a percent sign to this parameter so that. The created rev file will be equivalent to the file from RAR.
Percentage of the total volume. For example:
Rarv15% data
RAR, whether using the "RC" command or automatically, if the next volume cannot be found during decompression, and
Found the available quantity. Rev file, trying to rebuild the lost and damaged volumes.
The original copy of the damaged volume was renamed to *. It was broken before reconstruction. For example, volname.part03.rar.
Will be renamed as volname.part03.rar.bad
S[ name] converts compressed files into self-extracting format. Merge compressed files and self-extracting modules (using
The default.sfx module or switch). In the Windows version, default.sfx should be
It should be placed in the directory where RAR.exe is located, in the user's home directory in Unix, and in
/usr/lib or /usr/local/lib.
Delete the self-extracting module from the existing self-extracting compressed file. RAR created a file without self-extracting.
The new compressed file and the original self-extracting file of the module will not be deleted.
Ttest the compressed file. To verify the specified file, this command performs a virtual file decompression operation.
Don't write any output data streams.
Example:
Test the compressed file in the current directory:
Or for Unix:
rar t '* '
Starting from the current directory, test the compressed packages in all subdirectories:
rar t -r *
Or for Unix:
rar t -r '* '
U Update files in compressed files. Add files that are not in the compressed file, and update files that have changed after packaging.
Documents.
V[t, b] lists the contents of the compressed file in detail [technical information]. Format for file list: absolute path name, text
Comments, original size and compressed size, compression ratio, date and time of last update, attributes, CRC,
Compression method and minimum RAR version required for decompression. Optional technical information when using the "t" variable (main operation
System, entity tag and old file version tag). The variable "b" forces RAR to output only simple
File name, without any additional information.
Lists the contents of all compressed volumes, using an asterisk ("*") instead of the compressed file extension or "-v".
Switch.
Example:
List system.rar compresses the contents of the file (technical information) and redirects it to the output file techlist.lst
middle
Rar vt system & gttechlist.lst
X-band absolute path decompression
Example:
1) lists the contents of system.rar compressed file (technical mode) and outputs it with redirector.
Into the file techlist.lst
Rar vt system & gttechlist.lst
2) List the contents of tutorial.rar compressed files (simple file name mode).
Rar vb tutorial
Switch (used in combination with command):
-? Displays help for commands and switches. This is the same as when there are no parameters or illegal command line options are entered.
-Stop switch scanning
This switch tells RAR that there is no switch on the command line. If a file or file name is compressed
Start with a-sign and you can use it. If there is no "-"switch, such a name will be used as the switch.
Treat.
Example:
Add all files in the current directory to the entity compressed file' -StrangeName'
RAR name
-Clear archive properties after AC compression or decompression (Windows version only).
-ad Appends the compressed file name to the target path.
You can use this option when extracting a set of compressed files. By default, RAR transforms compressed text.
The decompressed files in the file are placed in the same directory, but this switch will decompress each compressed file.
Create a separate directory for all files.
Example:
x -ad *。 Rar data \
RAR creates a subdirectory under "Data" for each extracted file.
-ag[ format]
Generate a compressed file name using the current date and time.
When creating a compressed file, the current date string is appended to the compressed file name. Used for daily backups.
Other string formats define several optional format parameters, or use "YYYYMMDDHHMMSS".
The format of a string can contain the following characters:
Y year
moon
Use text strings as month names (January, February, and so on. )
What day is year W (every week begins on Monday)?
What day is it today (Monday-1, Sunday -7)
What day is D month?
When is the year of AD?
Scheduled start time of military operation
M- minutes (if after working hours, it is calculated in minutes)
second
N- number of compressed files. RAR searches whether a file named after the name to be generated exists. If you find it,
It already exists, and the compressed file number will be incremented until a unique name is generated.
Each string listed above represents only one character added to the compressed file name. For example,
Use WW to represent a two-digit week, or use YYYY to define a four-digit year.
If the first character in the format string is "+",it is the date string and the basic compressed file name.
The location is switched, so the date will be before the compressed file name.
The format string can contain optional characters contained in' {0}' and'}'. This article was put into the publishing house.
Abbreviated file name.
All other characters are added to the file name unchanged.
If you need to update existing compressed files, please use the -ag switch carefully. Rely on the past
The formatted string and time passed by -ag, and the generated and existing compressed file names can be
Can you not match it? In this case, RAR will create a new compressed file instead of updating the existing file.
There are files.
Example:
1) uses the default YYYYMMDDHHMMSS format.
Rar a -ag backup
2) Use DD-MMM-YY format.
YY backup
3) replace the date before "backup" with YYYYMMDDHHMM format.
Rar a -ag+YYYYMMDDHHMM backup
4) Use YYY-WW-A format, including chapter descriptions.
Rar a-agyyyy {year}-ww {week}-a {wday} backup
5) Use YYYYMMDD to compress the number of files. It allows you to use -agyymmdd-nn on the same day.
Many times, each new compressed file name will contain a new incremental number.
Rar a -agYYYYMMDD-NN backup
-ao Add files with archive properties
(Windows version only).
Example:
Add all files with archive attribute on c: to "f:backup" and clear the file archive attribute.
Rar a -r -ac -ao f: backup c:\*. *
-ap compressed file internal setting path. When you add a file to a compressed file, the path is integrated into the text.
In the file name, it is deleted from the file name when unzipping.
For example, if you want to add the file "readme.txt" to the directory compressed file "release"
In Document \ Project, you can run:
Rar a -apDOCS\ENG publishes readme.txt
Or extract "ENG" to the current directory:
Rar x -apDOCS publishes documents. *
-as synchronously compresses file contents
If this switch is used during compression, these files that are not in the currently added file list will be compressed.
The file will be deleted from the compressed file. It uses the combination of this switch and -u (update) to synchronize a.
It is convenient to compress the contents of files and compressed directories.
For example, after executing this command:
Rar a-u- as backup source. Card Print Processor (abbreviation for card print processor)
The compressed file "backup.rar" will only contain *. Cpp files and everything else.
The file will be deleted from the compressed file. This is similar to creating a new compressed file, but with a
Important difference: If no file has been modified since the last backup, this operation is better than creating a new file.
Shrink files quickly.
-av adds authentication (only registered version is available). RAR creates or updates compressed files every time.
Add information about the creator, last update time and compressed file name.
If you modify a compressed file that contains authentication without specifying this switch, the identity
The verification information will be deleted.
When the compressed file is decompressed, tested, listed or updated by using the' -av' switch, RAR will be completed.
Integrity confirmation and display information:
Verify identity information ...
If the authentication is successful, the message "OK", the name of the creator and the latest update will be displayed.
Information will be displayed. If the authentication fails, "Failed" will be displayed.
In software publishing environment, user authentication function' -av' is recommended.
In order to enable authentication, you must register the program. Please contact your local publishing point or website.
Cloth center.
-Prohibit av check or add authentication.
-cfg- Ignore configuration files and RAR environment variables.
-cl converts the file name to lowercase letters.
-cu converts file names to uppercase letters.
-c- Disables the display of comments.
Delete files after -df compression
Move the file to a compressed file. This switch is executed together with the command' a', and so is the command' m'.
Work.
-dh opens the * * * file.
Allows processing of files opened and written by other applications.
This switch is valid if the application allows read access to the file. But if the file is accessed,
If the type is private, the file opening operation will still fail.
This option is dangerous because it allows files to be compressed when they are repaired by other applications.
Change, so use it with caution.
-ds is added to an unordered entity compressed file.
-ed does not add an empty directory.
This switch indicates that the empty directory is not stored in the created compressed file. When this pressure is reduced
When shrinking a file, RAR creates a non-empty directory based on the internal file path. About empty directories
Missing information. A non-empty directory other than the name (access rights, streams, etc.). ) All other attributes are completed.
Partial loss, so use this switch only when you don't need to keep this information.
-ee does not handle extended properties.
Saving and repairing extension file properties is prohibited. Only applicable to OS/2 version.
-en Do not add a "compressed file end" block.
By default, RAR adds a "compressed file knot" at the end when creating or updating compressed files.
Bundle "blocks". It allows to skip extended data, such as digital security signatures, but under certain conditions.
Disabling these features may help. For example, if you pass
It may be correct when it is passed between two systems and the sender adds a new file to it at the same time.
It is important to realize that during transmission, the received part will not be modified by the other end.
This switch cannot be used for volume partitioning because the compressed file end block contains important information about the correct handling of the volume.
Rest.
-ep excludes the path from the name. If you include this switch, when you add a compressed file, the file will not contain the path.
Path information. This may result in multiple files with the same name in the compressed file.
-ep 1 Delete the bottom directory by name. The path entered on the command line will not be stored.
Example:
All files and directories in the tmp directory will be added to the compressed file "test", but will be compressed.
Abbreviated file name path does not contain "tmp\"
Rar a -ep 1 -r test tmp\*
This is equivalent to the following command:
cd tmp
Rar a -r..\ test
laser record ..
-ep2 Extends the path to a full path. The full path (except the drive letter and root directory) to store files during compression.
Diameter)
The -ep3 extension path is the full path containing the drive letter.
Only applicable to Win32 version.
If this switch is used during compression, the complete file path including the drive letter will be saved and restored. disk partition
The separator (colon) is replaced by the underscore character.
If you use -ep3 when extracting, it will change the underscore back to the colon and extract the file into it.
Original directories and disks. If the user also specifies the target path, it will be ignored.
This switch helps to back up multiple disks to the same compressed file. For example, you can run:
backup.rar c:\ d:\ e:\
To create a backup and:
rar x-ep3 backup.rar
To restore it.
Use the -ep3 switch carefully. Only you can confirm that the compressed file does not contain any malicious files. in other words
For example, if you create a compressed file yourself or you completely trust its author, use it. Giant panda opens.
Off allows you to overwrite any file anywhere on your computer, including important system files and
Usually only used for backup and recovery purposes.
-e[+]& lt; Attribute >
Specifies files that exclude or contain mask attributes.
The < attribute > is decimal, octal (starting from "0") or hexadecimal (starting from "0x").
Digital format of.
By default, this switch defines the exclusion mask without the "+"mark. If you are right,
And the file attribute is not 0, the file will not be added.
Compressed into a file.
If the "+"symbol exists, it specifies the inclusion mask. Only those elements with attributes specified in the mask.
At least one file will be added to the compressed file.
In the Windows version, you can also use d, s, h and a instead of digital mask symbols to represent directories and.
The system, hidden, archived and read-only properties of a file. The order of the given attributes is not important.
Unix version supports d and v symbols to define directory and device properties.
Allow -e
Example:
1) has only folder names, but no contents.
Rar a -r -e+d directory
2) Do not compress files with system and hidden attributes:
Rar a -esh file
-f Update file. Can be used when extracting or creating compressed files. The command string "a -f" is equivalent to
Command' f', you can also use' -f' with command' m' or' mf'. If you switch' -f' with life,
If' x' or' e' are used together, only the old file can be replaced by the new version extracted from the compressed file.
-hp[p] encrypts file data and file headers.
This switch is similar to -p[p], but the switch -p only encrypts the file data, but makes the file name, etc.
Other information is visible. This switch encrypts all data including file data, file name, size, attributes,
Comments and other blocks, so it provides higher security and so on.
Level. Using -hp encryption in compressed files, you can't even view the file list without a password.
Example:
Rar a -hpfGzq5yKw secret report. txt
With a password, the file report.txt will be added to the encrypted compressed file secret.rar.
' fGzq5yKw '
-id[c,d,p,q]
Disable messages.
Switch -idc disables the copyright string.
Switch -idd prohibits the display of the "done" string at the end of the operation.