调用WinRar或者Winzip的问题.(50分)

  • 主题发起人 主题发起人 grass1
  • 开始时间 开始时间
G

grass1

Unregistered / Unconfirmed
GUEST, unregistred user!
我曾经看到过一个程序.用来做数据备份和还原的.
调用了WinRar或者Winzip将数据库压缩到某一路径下(例如:c:/temp)
在此过程中,没有用户的干预和操作.
请问要实现这样的功能,有什么前提条件?如何实现?
 
你确定是直接调用 exe ?可能是使用压缩控件,同样可以压缩出 rar or zip 格式。

直接调用也可以,你不知道 rar 安装目录里面还有一个 DOS 程序吗?他就没有界面,直接
调用他,传入适当的参数就可以了,不需要用户干预。
 
能不能具体一些。
请给出相应的代码。比如在button.onclick事件下。
 
怎么具体你还没有回答我的问题,是调用exe还是用控件

如果你只是想达到压缩的目的,找个压缩控件就可以了,如 ZipTV 等
 
如果是直接调用的话,怎么办?
 
我也想知道
 
winrar命令行参考
rar a -o+ c:/11.mdb c:/temp/myback.rar

RAR command line syntax
~~~~~~~~~~~~~~~~~~~~~~~

Syntax

RAR <command> [ -<switches> ] <archive> [ <@listfiles...> ]
[ <files...> ] [ <path_to_extract/> ]

Description

Command line options (commands and switches) provides control of
creating and managing archives with RAR. The command is a string (or a
single letter) which commands RAR to perform a corresponding action.
Switches are designed to modify the way RAR performs the action. Other
parameters are archive name and files to be archived into or extracted
from the archive.

Listfiles are plain text files contained 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:

rar a backup @backup.lst

If you wish to read file names from stdin (standard input),
specify the empty listfile name (just @).

You may specify both usual file names and list files in the same
command line. If neither files nor listfiles are specified,
then *.* is implied and RAR will process all files

In a UNIX environment you need to quote wildcards to avoid them being
processed by RAR itself. For example, this command will extract
*.asm files from RAR archives in current path:

rar e '*.rar' '*.asm'


Command could be any of the following:

a Add files to archive.

Example:

create or update existent archive myarch, adding all files
in the current directory

rar a myarch


c Add archive comment. Comments are displayed while the archive is
being processed. Comment length is limited to 62000 bytes

Examples:

rar c distrib.rar

Also comments may be added from a file:

rar c -zinfo.txt dummy


cf Add files comment. File comments are displayed when the 'v'
command is given. File comment length is limited to 32767 bytes.

Example:

rar cf bigarch *.txt


cw Write archive comment to specified file.

Example:

rar cw oldarch comment.txt


d Delete files from archive. Note, if the processing of this
command resulted in removing all the files from the archive, the
empty archive would removed.


e Extract files to current directory.


f Freshen files in archive. Updates those files changed since they
were packed to the archive. This command will not add new files
to the archive.


k Lock archive. Any command which intends to change the archive
will be ignored.

Example:

rar k final.rar


l[t] List contents of archive [technical]. Files are listed as with
the 'v' command with the exception of the file path. i.e. only
the file name is displayed. Optional technical information
(host OS, solid flag and old version flag) is displayed
when 't' modifier is used.


m[f] Move to archive [files only]. Moving files and directories
results in the files and directories being erased upon
successful completion of the packing operation. Directories will
not be removed if 'f' modifier is used and/or '-ed' switch is
applied.


p Print file to stdout.


r Repair archive. Archive repairing is performed in two stages.
First, the damaged archive is searched for a recovery record
(see 'rr' command). If the archive contains a recovery record
and if the portion of the damaged data is continuous and less
than N*512 bytes, where N is number of recovery sectors placed
into the archive, the chance of successful archive
reconstruction is very high. When this stage has completed, a
new archive will be created, called _RECOVER.RAR.

If a broken archive does not contain a recovery record or if
the archive is not completely recovered due to major damage, a
second stage is performed. During this stage only the archive
structure is reconstructed and it is impossible to recover
files which fail the CRC validation, it is still possible to
recover undamaged files which were inaccessible due to the
broken archive structure. Mostly this is useful for non-solid
archives.

When the second stage is completed, the reconstructed archive
will be saved as _RECONST.RAR.

While the recovery is in progress, RAR may prompt the user for
assistance when a suspicious file is detected.

Suspicious entry

Name: <possibly filename>
Size: <size> Packed: <compressed size>

Add it: Yes/No/All

Answer 'y' to add this entry to the file _RECOVER.RAR.

Example:

rar r buggy.rar


rc Reconstruct missing volumes using recovery volumes
(.rev files). You need to specify any existing volume
as the archive name, for example, 'rar rc backup.part03.rar'

Read 'rv' command description for information about
recovery volumes.


rr[N] Add data recovery record. Optionally, redundant information
(recovery record) may be added to an archive. This will cause
a small increase of the archive size and helps to recover
archived files in case of floppy disk failure or data losses of
any other kind. A recovery record contains up to 32768 recovery
sectors. The number of sectors may be specified directly in the
'rr' command (N = 1, 2 .. 32768) or if it is not specified by the
user it will be selected automatically according to the archive
size: a size of the recovery information will be about 1%
of the total archive size, usually allowing the recovery of
up to 0.6% of the total archive size of continuously damaged data.

It is also possible to specify the recovery record size in
percent to the archive size. Just append the percent character
to the command parameter. For example:

rar rr3% arcname

Note that if you run this command from .bat or .cmd file,
you need to use rr3%% instead of rr3%, because the command
processor treats the single '%' character as start of
batch file parameter. You may also use 'p' instead of '%',
so 'rr3p' will work too.

If data are damaged continuously then each rr-sector helps to
recover 512 bytes of damaged information. This value may be
lower in cases of multiple damage.

The size of the recovery record may be approximately determined
by the formula <archive size>/256 + <number of recovery
sectors>*512 bytes.


rv[N] Create recovery volumes (.rev files), which can be later
used to reconstruct missing files in a volume set.
This command has sense only for multivolume archives
and you need to specify a name of the first volume
in the set as the archive name. For example:

rar rv3 data.part01.rar

This feature may be useful for backups or, for example,
when you posted a multivolume archive to a newsgroup
and a part of subscribers did not receive some files.
Reposting recovery volumes instead of usual volumes
may reduce a total number of files to repost.

Each recovery volume is able to reconstruct one missing
RAR volume. For example, if you have 30 volumes and
3 recovery volumes, you are able to reconstruct any
3 missing volumes. If number of .rev files is less than
number of missing volumes, reconstructing is impossible.
Total number of usual and recovery volumes must not
exceed 255.

The optional <N> parameter specifies a number of recovery
volumes to create and must be less than the total number
of RAR volumes in the set. You may also append a percent
character to this parameter, in such case the number of
creating .rev files will be equal to this percent taken
from the total number of RAR volumes. For example:

rar rv15% data.part01.rar

RAR reconstructs missing volumes either when using 'rc'
command or automatically, if it cannot locate the next
volume and finds the required number of .rev files
when unpacking.

Recovery volumes cannot correct damaged RAR files, but only
completely reconstruct missing ones, so if your volume
is corrupt and you want to repair it using recovery volumes,
just delete it and then run 'rc' command.

If recovery volume itself is corrupt, the result of
reconstructing is undefined. It is even possible that
a reconstructed volume will be also corrupt without any
warning when performing reconstructing.

Names of recovery volumes contain information important
for reconstruction (the total number of usual and recovery
volumes and the number of concrete recovery volume).
You must not rename usual or recovery volumes after they
were created, otherwise RAR will not able to reconstruct
them later.


s[name] Convert archive to SFX. The archive is merged with SFX-module
(using a module in file default.sfx or specified in the switch).
In the Windows version default.sfx should be placed in the
same directory as the rar.exe, in Unix - in the user's
home directory, in /usr/lib or /usr/local/lib.

s- Remove SFX module from the already existing SFX archive.
RAR creates a new archive without SFX module, the original
SFX archive is not deleted.

t Test archive files. This command performs a dummy file
extraction, writing nothing to the output stream, in order to
validate the specified file(s).

Examples:

Test archives in current directory:

rar t *

or for Unix:

rar t '*'

User may test archives in all sub-directories, starting
with the current path:

rar t -r *

or for Unix:

rar t -r '*'


u Update files in archive. Adds files not already in the archive
and updates files changed since they were packed to the archive.


v[t] Verbosely list the contents of archive [technical].
Files are listed using the format: full pathname, file comment,
original and compressed size, compression ratio, last update
date and time, attributes, CRC, compression method and minimum
RAR version required to extract. Optional technical information
(host OS, solid flag and old file version flag) is displayed
when 't' modifier is used.

To list the contents of all archive volumes, use an asterisk
('*') in place of the archive file extension or use the '-v'
switch.

Example:

direct archive content list (technical) to a file

rar vt bambam >bambam.lst


x Extract files with full path.

Example:

rar x -av- -c- dime 10cents.txt

extract specified file to current path. AV check and comment
show are disabled.


Switches (used in conjunction with a command):


-? Display help on commands and switches. The same as when none
or an illegal command line option is entered.


-- Stop switches scanning

This switch tells to RAR that there is no more switches
in the command line. It could be useful, if either archive
or file name starts from '-' character. Without '--' switch
such name would be treated as switch.

Example:

add all files from the current directory to the solid archive
'-StrangeName'

RAR a -s -- -StrangeName

-ac Clear Archive attribute after compression or extraction
(Windows version only).


-ad Append archive name to destination path.

This option may be useful when unpacking a group of archives.
By default RAR places files from all archives to the same
directory, but this switch creates a separate directory
for files unpacked from each archive.

Example:

rar x -ad *.rar data/

RAR will create for every unpacking archive subdirectories
below 'data'.


-ag[format]
Generate archive name using the current date and time.

Appends the current date string to an archive name when
creating an archive. Useful for daily backups.

Format of the appending string is defined by the optional
"format" parameter or by "YYYYMMDDHHMMSS" if this parameter
is absent. Format string may include the following characters:

Y - year
M - month
MMM - month name as text string (Jan, Feb, etc.)
W - a week number (a week starts with Monday)
A - day of week number (Monday is 1, Sunday - 7)
D - day of month
E - day of year
H - hours
M - minutes (treated as minutes if encountered after hours)
S - seconds

If the first character in the format string is '+', positions
of the date string and base archive name are exchanged,
so date will precede an archive name.

All other characters are added to an archive name without
changes.

Examples:

1) use the default YYYYMMDDHHMMSS format

rar a -ag backup

2) use DD-MMM-YY format

rar a -agDD-MMM-YY backup

3) use YYYYMMDDHHMM format, place date before 'backup'

rar a -ag+YYYYMMDDHHMM backup

4) use YYYY-WW-A format

rar a -agYYYY-WW-A backup


-ao Add files with Archive attribute set
(Windows version only).

Example:

add all disk C: files with Archive attribute set
to the 'f:backup' and clear files Archive attribute

rar a -r -ac -ao f:backup c:/*.*


-ap Set path inside archive. This path is merged to file
names when adding files to an archive and removed
from file names when extracting.

For example, if you wish to add the file 'readme.txt'
to the directory 'DOCS/ENG' of archive 'release',
you may run:

rar a -apDOCS/ENG release readme.txt

or to extract 'ENG' to the current directory:

rar x -apDOCS release DOCS/ENG/*.*


-as Synchronize archive contents

If this switch is used when archiving, those archived files
which are not present in the list of the currently added
files, will be deleted from archive. It is convenient to use
this switch in combination with -u (update) to synchronize
contents of an archive and an archiving directory.

For example, after the command:

rar a -u -as backup sources/*.cpp

the archive 'backup.rar' will contain only *.cpp files
from directory 'sources', all other files will be deleted
from the archive. It looks similar to creating a new archive,
but with the one important exception: if no files are
modified since a last backup, the operation is performed
much faster than creation of a new archive.


-av Put authenticity verification (registered versions only).
RAR will put, in every new and updated archive, information
concerning the creator, last update time and archive name.

If an archive, containing authenticity verification, is being
modified and this switch is not specified, the authenticity
verification information will be removed.

When extracting, testing, listing or updating and archive with
the '-av' switch, RAR will perform integrity validation and
display the message:

Verifying authenticity information ...

In the case of successful authenticity verification, the message
'Ok', creator name and last update information will be
displayed. In the case of authenticity verification failure, the
message 'FAILED' will be displayed.

The Authenticity Verification feature, '-av,' is recommended for
use with archives in a software distribution environment.

In order to enable the Authenticity verification feature, the
program MUST be registered. Please contact your local
distribution site or the world-wide distribution center.


-av- Disable authenticity verification checking or adding.


-cfg- Disable read configuration and environment.


-cl Convert file names to lower case.


-cu Convert file names to upper case.


-c- Disable comments show.


-df Delete files after archiving

Move files to archive. This switch in combination with
the command "A" performs the same action as the command "M".


-dh Open shared files

Allows to process files opened by other applications
for writing.

This option could be dangerous, because it allows
to archive a file, which at the same time is modifying
by an other application, so use it carefully.


-ds Do not sort files while adding to a solid archive.


-ed Do not add empty directories

This switch indicates that empty directories are not to be
stored in the created archive.


-ee Do not process extended attributes

Disables saving and restoring extended file attributes.
Only for OS/2 versions.


-en Do not add "end of archive" block

By default, RAR adds "end of archive" block to the end of new
or updated archive. It allows to skip external data like
digital signatures safely, but in some special cases it may be
useful to disable this feature. For example, if an archive
is transferred between two systems via a unreliable link and
at the same time a sender adds new files to it, it may be
important to be sure that the already received file part will
not be modified on the other end between transfer sessions.

This switch cannot be used with volumes, because the end
of archive block contains information important for correct
volume processing.


-ep Exclude paths from names. This switch enables files to be added
to an archive without including the path information. This
could, of course, result in multiple files existing in the
archive with the same name.


-ep1 Exclude base dir from names. Do not store the path entered in
the command line.

Example:

all files and directories from the directory tmp will be added
to the archive 'test', but the path in archived names will not
include 'tmp/'

rar a -ep1 -r test tmp/*

This is equivalent to the commands:

cd tmp
rar a -r ../test
cd ..


-ep2 Expand paths to full. Store full file paths (except a drive
letter and leading path separator) when archiving.


-e<atr> Specifies file exclude attributes mask. <atr> is a number in the
decimal, octal (with leading '0') or hex (with leading '0x')
format. If result of bitwise AND between <atr> and file
attributes is nonzero, then file would not be added to archive.

In the Windows version also is possible to use instead of
digital mask symbols D, S, H, A and R to denote directories
and files with system, hidden, archive and read-only attributes.
The order in which the attributes are given is not significant.


-f Freshen files. May be used with archive extraction or creation.
The command string "a -f" is equivalent to the command 'f', you
could also use the switch '-f' with the commands 'm' or 'mf'. If
the switch '-f' is used with the commands 'x' or 'e', then only
old files would be replaced with new versions extracted from the
archive.


-hp[p] Encrypt both file data and headers.

This switch is similar to -p[p], but switch -p encrypts
only file data and leaves other information like file names
visible. This switch encrypts all sensitive archive areas
include file data, file names, sizes, attributes, comments
and other blocks, so it provides a higher security level.
Without a password it is impossible to view even the list of
files in archive encrypted with -hp.

Example:

rar a -hpfGzq5yKw secret report.txt

will add the file report.txt to the encrypted archive
secret.rar using the password 'fGzq5yKw'


-idp Disable percentage indicator.

May be useful when redirecting output to a file.


-ieml[.][addr]
Send archive by email. Win32 version only.

Attach an archive created or updated by the add command
to email message. You need to have MAPI compliant email
client to use this switch (most modern email programs
support MAPI interface).

You may enter a destination email address directly
in the switch or leave it blank. In the latter case it
will be asked by your email program. It is possible to
specify several addresses separated with commas or
semicolons.

If you append a dot character to -ieml, an archive will be
deleted after it was successfully attached to email.
If the switch is used when creating a multivolume archive,
every volume is attached to separate email message.


-ierr Send all messages to stderr.


-ilog[name]
Log errors to file (registered version only).

Write error messages to the file rar.log created in RAR
directory. It is possible to specify another log file name
instead of the default rar.log in the switch, for example,
-ilogc:/log/backup.log. If the specifed name does not
include path, the log file will be created in RAR directory.


-inul Disable all messages.


-isnd Enable sound.


-k Lock archive. Any command which intends to change the archive
will be ignored.


-kb Keep broken extracted files.

RAR, by default, deletes files with CRC errors after
extraction. The switch -kb specifies that files with
CRC errors should not be deleted.


-m<n> Set compression method:

-m0 store do not compress file when adding to archive
-m1 fastest use fastest method (less compressive)
-m2 fast use fast compression method
-m3 normal use normal (default) compression method
-m4 good use good compression method (more
compressive, but slower)
-m5 best use best compression method (slightly more
compressive, but slowest)

If this switch is not specified, RAR uses -m3 method
(normal compression).

By default, RAR uses only the general compression
algorithm in -m1 and -m2 methods, advanced algorithms
like audio and true color processing are enabled
only in -m3..-m5 modes, the advanced text compression
is activated only in -m4..-m5. This default can be
overridden using -mc switch.


-mc<par>
Set advanced compression parameters.

This switch is intended mainly for benchmarking and
experiments, in the real environment usually it is better
to allow RAR to select optimal parameters automatically.
Please note that improper use of this switch may lead
to very serious performance and compression loss, so use
it only if you clearly understand what you do.

It has the following syntax:

-mc[param1][:param2][module][+ or -]

where <module> is the one character field denoting a part
of the compression algorithm, which has to be configured.

It may have the following values:

A - audio compression;
C - true color (RGB) data compression;
D - delta compression;
E - 32-bit x86 executables compression;
I - 64-bit Intel Itanium executables compression;
T - text compression.

'+' sign at the end of switch applies the selected algorithm
module to all processed data, '-' disables the module at all.
If no sign is specified, RAR will choose modules automatically,
basing on data and the current compression method.

Switch -mc- disables all optional modules and allows only
the general compression algorithm.

<Param1> and <Param2> are module dependent parameters
described below.

Audio compression, delta compression:

<Param1> is a number of byte channels (can be 1 - 31).
RAR splits multibyte channels to bytes, for example,
two 16-bit audio channels are considered by RAR as four
channels one byte each.

<Param2> is ignored.


32-bit x86 Intel executables compression,
64-bit Intel Itanium executables compression,
true color (RGB) data compression:

<Param1> and <Param2> are ignored.


Text compression:

<Param1> is the order of PPM algorithm (can be 2 - 63).
Usually a higher value slightly increases the compression ratio
of redundant data, but only if enough memory is available
to PPM. In case of lack of memory the result may be negative.
Higher order values decrease both compression and decompression
speed.

<Param2> is memory in megabytes allocated for PPM (1-128).
Higher values may increase the compression ratio, but note
that PPM uses the equal memory size both to compress and
decompress, so if you allocate too much memory when creating
an archive, other people may have problems when decompressing
it on a computer with less memory installed. Decompression
will be still possible using virtual memory, but it may
become very slow.


Examples:

1) switch -mc1a+ forces use of 8-bit mono audio compression
for all data.

2) switch -mc10:40t+ forces use of text compression
algorithm for all data, sets the compression order to 10
and allocates 40 MB memory.

3) switch -mc12t sets the text compression order to 12,
when the text compression is used, but leaves to RAR to
decide when to use it.

4) switches -mct- -mcd- disable text and delta compression.


-md<n> Select dictionary size <n> in KB. Must be 64, 128, 256, 512,
1024, 2048 or 4096 or a letter 'a', 'b', 'c', 'd', 'e', 'f', 'g'
respectively.

The sliding dictionary is a special memory area used by the
compression algorithm. If the size of the file being compressed
(or the total files size in the case of a solid archive) is
greater than the dictionary size, then increasing the dictionary
size will generally increase compression ratio, decrease packing
speed and increase memory requirements.

RAR can reduce the dictionary size if it is significantly
larger than size of source data. It helps to reduce memory
requirements without decreasing compression.

Default sliding dictionary size is 4096 KB.

Example:

RAR a -s -mdd sources *.asm
or
RAR a -s -md512 sources *.asm

Will create a solid archive using a 512 KB dictionary.


-ms

  • Specify file types to store.

    Specify file types, which will be stored without compression.
    This switch may be used to store already compressed files,
    what helps to increase archiving speed without noticeable loss
    in the compression ratio.

    Optional <list> parameter defines the list of file extensions
    separated with a semicolon. For example, -msrar;zip;jpg will
    force RAR to store without compression all RAR and ZIP
    archives and JPG images. It is also allowed to specify wildcard
    file masks in the list, so -ms*.rar;*.zip;*.jpg will work too.

    If <list> is not specified, -ms switch will use the default
    set of extensions, which includes the following file types:

    ace, arj, bz2, cab, gz, jpeg, jpg, lha, lzh, mp3,
    rar, zip, taz, tgz, z


    -ol Save symbolic links as the link instead of the file.
    Unix version only.


    -os Save NTFS streams. Win32 version only.

    This switch has meaning only for NTFS file system under
    Windows NT and allows to save alternative data streams
    associated with a file. It is especially important under
    Windows 2000, which uses streams to keep some file dependent
    information like file descriptions. If you use RAR to backup
    your NTFS disks, it is recommended to specify this switch.


    -ow Use this switch when archiving to save file security
    information and when extracting to restore it.

    Unix RAR version saves file owner and group when using
    this switch.

    Win32 version stores owner, group, file permissions and
    audit information, but only if you have necessary privileges
    to read them. Note that only NTFS file system supports
    file based security under Windows.

    -o+ Overwrite existing files.


    -o- Do not overwrite existing files.


    -p[p] Encrypt files with the string <p> as password while archiving.
    The password is case-sensitive. If you omit the password on the
    command line, you will be prompted with message "Enter password".

    Example:

    rar a -pmyhoney secret1 *.txt

    add files *.txt and encrypt them with password "myhoney".


    -p- Do not query password


    -r Recurse subdirectories. May be used with commands:
    a, u, f, m, x, e, t, p, v, l, c, cf and s.

    When used with the commands 'a', 'u', 'f', 'm' will process
    files in all sub-directories as well as the current working
    directory.

    When used with the commands x, e, t, p, v, l, c, cf or s will
    process all archives in sub-directories as well as the current
    working directory.


    -r0 Similar to -r, but when used with the commands 'a', 'u', 'f',
    'm' will recurse subdirectories only for those names, which
    include wildcard characters '*' and '?'


    -ri<p>[:<s>]
    Set priority and sleep time. Available only in RAR for Windows.
    This switch is used to regulate system load by RAR in a
    multitasking environment. The possible task priority values are
    from 0 to 15. When <p> is equal to 0, the default task priority
    is used, 1 corresponding to the lowest task priority, 15 - to
    the highest. The sleep time <s> is a value from 0 to 1000
    (milliseconds). This is the period of time that RAR will give
    back to system after every read or write during the packing or
    unpacking operation. The sleep time setting is useful when
    several tasks with the same priority are running in the system.

    Example:

    execute RAR with default priority and 10 ms of sleep after
    each read or write

    rar a -r -sfx -ri0:10 backup *.*


    -rr[N] Add a data recovery record. This switch is used when creating or
    modifying archive to add a data recovery record to the archive.
    See the 'rr[N]' command description for details.


    -rv[N] Create recovery volumes. This switch is used when creating
    a multivolume archive to generate recovery volumes.
    See the 'rv[N]' command description for details.


    -s Create solid archive. Solid is a special archive type. Please
    refer to the appendix "Glossary" for further information.

    Example:

    create solid archive sources.rar with 512 KB dictionary,
    recursing all directories, starting with the current directory.
    Add only .asm files:

    rar a -s -md512 sources.rar *.asm -r


    -s<N> Create solid groups using file count

    Similar to -s, but reset solid statistics after compressing
    <N> files. Usually decreases compression, but also
    decreases losses in case of solid archive damages.


    -se Create solid groups using extension

    Similar to -s, but reset solid statistics if file extension
    is changed. Usually decreases compression, but also
    decreases losses from solid archive damages.


    -sv Create independent solid volumes

    By default RAR tries to reset solid statistics as soon
    as possible when starting a new volume, but only
    if a lot enough data was packed after a previous reset
    (at least a few megabytes).

    This switch forces RAR to ignore packed data size and attempt
    to reset statistics for volumes of any size. It decreases
    compression, but increases chances to extract a part of data
    if one of solid volumes in volume set was lost or damaged.

    Note that sometimes RAR cannot reset statistics even
    using this switch. For example, it cannot be done when
    compressing one large file split between several volumes.
    RAR is able to reset solid statistics only between separate
    files, but not inside of single file.

    Ignored, if used to create non-volume archive.


    -sv- Create dependent solid volumes

    Disables to reset solid statistics between volumes.

    It slightly increases compression, but significantly reduces
    chances to extract a part of data if one of solid volumes
    in volume set was lost or damaged.

    Ignored, if used to create non-volume archive.


    -s- Disable solid archiving


    -sfx[name]
    Create SFX archives. If this switch is used when creating a new
    archive, a Self-Extracting archive (using a module in file
    default.sfx or specified in the switch) would be created.
    In the Windows version default.sfx should be placed in the
    same directory as the rar.exe, in Unix - in the user's
    home directory, in /usr/lib or /usr/local/lib.

    Example:

    rar a -sfxwincon.sfx myinst

    create SelF-eXtracting (SFX) archive using wincon.sfx
    SFX-module.


    -t Test files after archiving. This switch is especially
    useful in combination with the move command, so files will be
    deleted only if archive had been successfully tested.


    -ta<date>
    Process only files modified after the specified date.

    Format of the date string is YYYYMMDDHHMMSS.
    It is allowed to insert separators like '-' or ':' to
    the date string and omit trailing fields. For example,
    the following switch is correct: -ta2001-11-20
    Internally it will be expanded to -ta20011120000000
    and treated as "files modified after 0 hour 0 minutes
    0 seconds of 20 November 2001".


    -tb<date>
    Process only files modified before the specified date.
    Format of the switch is the same as -ta<date>.


    -tk Keep original archive date. Prevents RAR from modifying the
    archive date when changing an archive.


    -tl Set archive time to newest file. Forces RAR to set the date of a
    changed archive to the date of the newest file in the archive.


    -tn<time>
    Process files newer than the specified time period. Format
    of the time string is:

    [<ndays>d][<nhours>h][<nminutes>m][<nseconds>s]

    For example, use switch -tn15d to process files newer
    than 15 days and -tn2h30m to process files newer than
    2 hours 30 minutes.


    -to<time>
    Process files older than the specified time period. Format
    of the switch is the same as -tn<time>.


    -u Update files. May be used with archive extraction or creation.
    The command string "a -u" is equivalent to the command 'u', you
    could also use the switch '-u' with the commands 'm' or 'mf'. If
    the switch '-u' is used with the commands 'x' or 'e', then files
    not present on the disk and files newer than their copies on the
    disk would extracted from the archive.


    -v<size>[k|b|f|m|M]
    Create volumes with size=<size>*1000 [*1024 | *1].
    By default this switch uses <size> as thousands (1000) of bytes
    (not 1024 x bytes). You may also enter the size in kilobytes
    using the symbol 'k', in bytes using the symbol 'b',
    in megabytes - 'm', in millions of bytes - 'M' or select
    one of several predefined values using the symbol 'f'
    following the numerical value. Predefined values can be
    360, 720, 1200, 1440 or 2880 and replaced with corresponding
    floppy disk size.

    If the size is omitted, autodetection will be used.

    If volumes are created on removable media, then after
    the first volume has been created, user will be prompted
    with:

    Create next volume: Yes/No/All

    At this moment in time, you should change the disks. Answering
    'A' will cause all volumes to be created without a pause.

    By default RAR volumes have names like 'volname.partNNN.rar',
    where NNN is the volume number. Using -vn switch it is
    possible to switch to another, extension based naming scheme,
    where the first volume file in a multi-volume set has
    the extension .rar, following volumes are numbered from .r00
    to .r99.

    When extracting or testing a multi-volume archive you must use
    only the first volume name. If there is no next volume
    on the drive and the disk is removable, the user will be
    prompted with:

    Insert disk with <next volume name>

    Insert the disk with the correct volume and press any key.

    If while extracting, the next volume is not found and volumes
    are placed on the non-removable disk, RAR will abort with
    the error message:

    Cannot find <volume name>

    Archive volumes may not be modified. The commands 'd', 'f', 'u',
    's' cannot be used with Multi-volume sets. The command 'a' may
    be used only for the creation of a new multi-volume sequence.

    It is possible, although unlikely, that the file size, of a file
    in a multi-volume set, could be greater than it's uncompressed
    size. This is due to the fact that 'storing' (no compression if
    size increases) cannot be enabled for multi-volume sets.

    Archive volumes may be Self-Extracting (SFX). Such an archive
    should be created using both the '-v' and '-sfx' switches.

    Example:

    create archive in volumes of fixed size:

    rar a -s -v1440 floparch.rar *.*

    will create solid volumes of size 1440000 bytes.


    -vd Erase disk contents before creating volume

    All files and directories on the target disk will be erased
    when '-vd' is used. The switch applies only to removable
    media, the hard disk cannot be erased using this switch.


    -ver[n] File version control

    Forces RAR to keep previous file versions when updating
    files in the already existing archive. Old versions are
    renamed to 'filename;n', where 'n' is the version number.

    By default, when unpacking an archive without the switch
    -ver, RAR extracts only the last added file version, which
    name does not include a numeric suffix. But if you specify
    a file name exactly, including a version, it will be also
    unpacked. For example, 'rar x arcname' will unpack only
    last versions, when 'rar x arcname file.txt;5' will unpack
    'file.txt;5', if it is present in the archive.

    If you specify -ver switch without a parameter when unpacking,
    RAR will extract all versions of all files matched to entered
    file mask. In this case a version number is not removed from
    unpacked file names. You may also extract a concrete file
    version specifying its number as -ver parameter. It will tell
    RAR to unpack only this version and remove a version number
    from file names. For example, 'rar x -ver5 arcname' will
    unpack only 5th file versions.


    -vn Use the old style volume naming scheme

    By default RAR volumes have names like 'volname.partNNN.rar',
    where NNN is the volume number. Using -vn switch it is
    possible to switch to another, extension based naming scheme,
    where the first volume file in a multi-volume set has
    the extension .rar, following volumes are numbered from .r00
    to .r99. It may have sense, if you are going to unpack
    an archive under the plain MS DOS, which does not allow
    more than one dot in a file name.


    -vp Pause before each volume

    By default RAR asks for confirmation before creating or
    unpacking next volume only for removable drives.
    This switch forces RAR to ask such confirmation always.
    It can be useful if disk space is limited and you wish
    to copy each volume to another media immediately after
    creating.


    -w<p> Assign work directory as <p>. This switch may be used to assign
    the directory for temporary files.


    -x<f> Exclude specified file <f>, wildcards may be used both
    in the name and file parts of file mask. You may specify
    the switch '-x' several times:

    Examples:

    1) rar a -r -x*.bak -x*.rar rawfiles

    *.bak and *.rar files will not be added to rawfiles

    2) rar a -r -x*/temp/* savec c:/*

    compress all files on the disk c: except those in temp folders


    -x@<lf> Exclude files using specified list file.

    Example:

    rar a -x@exlist.txt arch *.exe


    -y Assume Yes on all queries.


    -z<f> Read archive comment from file <f>.
 
直接调用exe不太好吧,对方机子里没有装怎么办,难道运行环境要求中
写上需要winzip或winrar支持吗?或者你给带一个?
其实好多压缩控件都挺好用,比如vclzip等。
 
調用是一個好辦法,當年我們用FOXPRO for dos的時候就是調用ARJ來備份DBF數據庫的
效果還不錯,最好找一個FREE的軟件來調用,WINRAR和WINZIP的壓縮部分都是SHARE的
連同你的軟件一起發放,需要作者授權
 
现在压缩备份是可以了,但是如何把他还原回来呢?
我英语不好,能不能直接一点啊?
 
没人知道怎么恢复吗?
 

用户手册
~~~~~~~~
RAR 3.00 32位 命令行版本
~~~~~~~~~~~~~~~~~~~~~~~~

=-=-=-=-=-=-=-=-=-=-=-=-=-=-
欢迎使用 RAR 压缩软件!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=

介绍
~~~~

RAR 是一个强大的工具,允许您管理及操作压缩包,这类文件通常就是带有
“.rar” 的扩展名的标准文件。

RAR 的特色包括:-

* 高精密度的独创压缩演算法
* 针对文本、音频、图象数据,32位或64位英特尔可执行程序进行优化的特
殊压缩算法
* 使用“固实”压缩,比类似的压缩工具有更好的性能
* 身份验证(仅适用于注册版)
* 自解压包及分卷压缩(分卷自解压)
* 修复物理损坏的压缩包的能力
* 锁定、密码、文件顺序列表、文件安全性及更多...


配置文件
~~~~~~~~

Unix 版本的 RAR 从用户的根目录(存储在 HOME 环境变量)或 /etc 目录下的
.rarrc 文件读取配置信息。

Windows 版本的 RAR 从 rar.exe 相同目录下的 rar.ini 读取配置信息。

这个文件包含下列的字串:

选项=<任何的 RAR 参数,以空格分开>


环境变量
~~~~~~~~

通过创建“RAR”环境变量可以给RAR 的命令行添加默认参数。

例如,在 UNIX 环境下的下列参数可添加您的配置文件:

RAR='-s -md1024'
export RAR

在命令行方式下,RAR 将会使用这些字串做为默认参数并使用 1024Kb 的可
变字典创建固实压缩包。

RAR 控制选项优先级如下所示:

命令行参数 最高优先级
RAR 环境变量参数 较低优先级
保存在配置文件内的参数 最低优先级


日志文件
~~~~~~~~

如果在命令行或配置文件里指定参数 -ilog,RAR 会把包括处理压缩文件时产
生的错误等信息写入到日志文件中。在 Unix 下此文件名为 .rarlog,保存在
用户的 Home 目录。在 Windows 下叫做 rar.log,放在 rar.exe 的同一个目
录中。-ilog 参数允许修改默认的日志文件名。


固实压缩的文件顺序列表 - rarfiles.lst
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

rarfiles.lst 包含用户定义的文件列表,设置 RAR 添加文件到固实压缩包的
顺序,包含了文件名、通配符及特殊条目 - $default。default 条目定义了与
这个文件中其他条目不相符的文件的压缩顺序。注释的字符是 ';'。

在 Windows 下,此文件必须放在与 RAR 同样的目录下。在 Unix 下,放在使
用者的 Home 目录或 /etc 目录。

提高压缩比和速度的操作技巧:

- 相似的文件,在压缩包内归类到一起;
- 频繁访问的文件应该放在开始


RAR 命令行语法
~~~~~~~~~~~~~~

语法

RAR <命令> [-<选项>] <压缩包> <@文件列表...> [<文件...>] [<解压缩路径/>]

描述

命令行选项(命令及选项)提供 RAR 创建及管理控制压缩包的控制。命令是一
个字串(或单个字母),命令 RAR 执行相应的操作。选项则用来修改 RAR 执
行操作的方式。其他的参数则是压缩包名称、要压缩的文件或要从压缩包解
压的文件。

文件列表是纯文本文件包含要处理的文件名。第一列应该以文件名开始。文
件列表可以在 // 字符后添加注释。例如,您可以创建 backup.lst 包含如
下字符串:

c:/work/doc/*.txt //备份文本文档
c:/work/image/*.bmp //备份图像
c:/work/misc

然后执行:

rar a backup @backup.lst

如果您想要从stdin(标准输入)中读取文件名,请指定一个不存在的文件列
表名(仅用字符 @)。

在同一命令行中,您可以同时指定正常文件名和列表文件。如果两者都没指
定,那么表示的是所有文件(*.*),RAR 将处理所有的文件。

在 UNIX 环境中,您必须将通配符置于引号中,以避免 RAR 处理到通配符本
身。例如,以下命令会在当前路径下从 RAR 压缩包解压缩 *.asm 文件:

rar e '*.rar' '*.asm'


命令可以是以下的任何一个:

a 添加文件到压缩包。

示例:

创建或更新现存的 myarch 压缩包,添加当前目录下的所有文件

rar a myarch


c 添加压缩包注释。注释会在处理压缩包时显示。注释长度限制为
62000 字节

示例:

rar c distrib.rar

注释也可以从文件添加:

rar c -zinfo.txt dummy


cf 添加文件注释。文件注释会在使用命令 'v' 的时候显示。文件注
释的长度限制为 32767 字节。

示例:

rar cf bigarch *.txt


cw 将压缩包注释写到指定的文件。

示例:

rar cw oldarch comment.txt


d 从压缩包删除文件。请注意,如果这个命令的结果是删除压缩包里
的所有文件,空的压缩包会被删除。


e 解压缩文件到当前目录。


f 更新压缩包里的文件。仅更新那些在压缩后又更改了的文件。
此命令不会添加新的文件到压缩包。


k 锁定压缩包。将会忽略任何修改压缩包的命令。

示例:

rar k final.rar


l[t] 列出压缩包的内容 [技术信息]。和 'v' 命令一样列出文件,但不
包括文件路径。也就是只显示文件名。可选的技术性信息(压缩时
所使用的主机、固实标志和旧版本标志)只有在使用 't' 修饰符
时才会显示出来。


m[f] 移动到压缩包 [仅文件]。文件和目录的移动,其结果是源目录和源
文件在压缩操作成功后被删除。如果使用 'f' 修饰符 或者使用
'-ed' 选项,则不删除目录。


p 打印文件到标准输出设备。


r 修复压缩包。压缩包修复由二个阶段组成。首先,会扫描损坏的压
缩包寻找恢复记录(参阅 'rr' 命令)。如果压缩包含有恢复记录,
并且损坏的数据部分是连续性的,并少于 N*512 字节,N 代表压
缩包内恢复扇区的数目,压缩包成功重建的机会是非常高的。这个
阶段完成后,将会创建新的压缩包,名字叫做 _RECOVER.RAR。

如果损坏的压缩包不包含恢复记录,或者如果压缩包由于严重的损
坏,而不能够完全地恢复时,第二阶段处理开始。在此期间,只能
重建压缩包的结构,不能恢复 CRC 校验失败的文件,但仍然可能
恢复因为损坏的压缩包结构而不能访问的未损坏的文件。通常这对
非固实压缩包很有效。

第二阶段完成后,重建的压缩包将被保存为 _reconst.rar。

在恢复过程中,检测到可疑的文件时,RAR 会提示用户加以协助。

可疑的项目

名称: <可能的文件名>
大小: <大小> 压缩后: <压缩包大小>

将它添加到压缩包: Yes/No/All

输入“Y”把这个文件添加到压缩包 _recover.rar。

示例:

rar r buggy.rar

rc 利用恢复分卷(.rev文件)来重建丢失的分卷文件。您需要指定任
何存在的分卷文件作为压缩包名称,例如:

rar rc backup.part03.rar

关于恢复分卷的数据请参阅 'rv' 的命令描述。

rr[N] 添加数据恢复记录。可选择项,冗余信息(恢复记录)可以添加到压
缩包中,这会稍微增加压缩包的大小,但在软盘失效或者其他数据
丢失的情况下,可以帮助修复压缩包。恢复记录最多可包含 32768
个恢复扇区。扇区的数量可以在 “rr” 命令直接指定(N = 1, 2
..32768)。如果用户未指定,则根据压缩包大小自动选择:恢复信
息的大小大约是压缩文件总计大小的 1% ,通常允许恢复最高达压
缩文件总计大小 0.6%的连续受损数据。

也可以将恢复记录的大小指定为压缩包大小的百分比,只要在命令
参数后面附加百分比符号,例如:

rar rr3% arcname

注意,如果您从 .bat 或 .cmd 文件执行这条命令,您必须使用
rr3%% 来代替 rr3%,因为命令处理器会把单个的 '%' 字符当成批
处理文件参数的开始。您也可以使用 'p' 来代替 '%',即 'rr3p'
也照常运行。

如果受损的数据是连续性的,每一个恢复扇区都可以帮助恢复 512
个字节的受损信息,在多处受损情况下,这个值将会降低。

恢复记录的大小由公式近似确定为:

<压缩包大小> / 256 + <恢复扇区数量> * 512 字节。

rv[N] 创建恢复分卷(.rev 文件),以便将来用于重建丢失的分卷文件。
这个命令仅能被多卷压缩所识别,而且您要指定第一个分卷文件的
文件名。示例:

rar rv3 data.part01.rar

这个特性可能对文件备份有很大用途,或者例如,您发送一个多卷
压缩包给新闻组可是有些用户没有收到部分文件。重新发送恢复分
卷来代替正常的分卷可以减少重新发送的文件数。

每个恢复分卷可以重建一个丢失的 RAR 分卷文件。例如,您有30
个分卷文件和3个恢复分卷,您可以重建任何3个丢失的分卷文件。
如果 .rev 文件的数量少于丢失的分卷文件,那么无法重建。正常
分卷文件和恢复分卷文件的总数不能超过255。

可选的参数 <N> 用来指定建立的恢复分卷数目,且该数目必须小
于这批 RAR 分卷的总数。您也可以为参数附加一个百分比字符,
这种情况下创建的 .rev 文件数将会等于 RAR 分卷总数的百分比
示例:

rar rv15% data.part01.rar

RAR 重建丢失的分卷文件可以通过使用 'rc' 命令或是在如果找不
到下一分卷,并找到了需要数量的 .ref 文件时,自动进行。

恢复分卷不能用来恢复损坏的 RAR 文件,却只能完整的重建丢失
的分卷文件。所以,如果您的分卷文件损坏了,而您想用恢复分卷
来修复,只要将该分卷文件删除,然后运行 'rc' 命令重建即可。

如果恢复分卷本身已经损坏,重建的结果会未知。也可能重建的新
分卷文件也是损坏的,然而在执行重建时没有任何的警告。

恢复分卷的名称包含着重建的重要信息 (正常分卷和恢复分卷的总
数以及恢复分卷的数目)。您不能在常规分卷文件和恢复分卷文件
创建之后给在它们改名,否则 RAR 将不能重建它们。

s[名称] 转换压缩包成为自解压包。压缩包与自解压模块被合并(使用
default.sfx 中的模块或在选项中指定)。在Windows 环境下,
default.sfx 必须放在与 rar.exe 相同的文件夹下面,在 Unix
下,则放在用户的 Home 目录下或 /usr/lib 或者
/usr/local/lib 下。

s- 从自解压包内删除自解压模块。
RAR 会创建不含自解压模块的新压缩包,而原有的自解压包并不会
删除。


t 测试压缩包内的文件。为了验证指定的文件,这个命令会执行虚拟
的文件解压缩,不写出任何输出数据流。

示例:

测试在当前目录的压缩包:

rar t *

或在 Unix 时:

rar t '*'

从当前目录开始,测试所有子目录下的压缩包:

rar t -r *

或在 Unix 时:

rar t -r '*'


u 更新压缩包内的文件。添加不存在的文件和更新压缩后改变了的文
件。


v[t] 压缩包内容的详细列表 [技术信息]。
文件会以下列格式列出: 完整路径名称、文件注释、原始及压缩后
大小、压缩比、上次更新日期和时间、属性、CRC、压缩方法以及解
压缩所需的最低版号。使用 't' 时,可选择的技术信息将显示(压
缩时的操作系统、固实标志和旧版本标志)。

要列出全部压缩分卷的内容,使用通配符 ('*') 替换压缩包的扩展
名,或者使用 '-v' 选项

示例:

将压缩包内容列表(含技术信息)重定向到文件

rar vt bambam >bambam.lst


x 含完整路径解压缩文件

示例:

rar x -av- -c- dime 10cents.txt

解压缩特定文件到当前文件夹,关闭 AV 检查和显示注释


选项(与命令结合使用):


-? 显示命令及选项的帮助。当未输入命令或者输入无效的命令行选项
时也会显示。


-- 停止选项扫描

这个选项会通知 RAR 在命令行已没有其他的选项了。
如果压缩包的名称或文件名是以“-”字符开始的时候,他可能很有
用。没有“--”选项时,则会将这些名称当作选项来处理。

示例:

从当前文件夹添加所有文件到固实压缩包 -StrangeName 里

RAR a -s -- -StrangeName


-ac 压缩或解压缩后,清除文件的“存档”属性 (仅对 Windows 版本有
效)。

-ad 附加压缩包名称到目标路径

在解压缩一组压缩包时,该参数可能很有用。默认情况下,RAR 会
把所有的压缩包解压缩到同一个目录下,而使用这个参数可以把它
们解压缩到各自的目录中。

示例:

rar x -ad *.rar data/

RAR将会为每一个解压缩包在'data'文件夹下创建子文件夹。


-ag[格式] 用当前日期产生压缩包名

当创建压缩包时,附加当前日期字串到压缩包名,这对于每天的备
份很有用。

附加字串的格式由“格式”参数所定义,或者没有参数时,使用
“YYYYMMDDHHMMSS”。格式字串可以包含下列的字符:

Y - 年
M - 月
MMM - 文本方式的月份名称(Jan, Feb, 等)
W - 年的第几周(每周起始于星期一)
A - 周的天数(星期一为 1, 星期日为 - 7)
D - 月的第几天
E - 年的第几天
H - 时
M - 分(如果出现在小时后面,则视为分)
S - 秒

如果格式字串的第一个字符是 '+',日期字串和压缩包的基本名字
的位置就会互换,这样日期会先于压缩包文件名

所有其他添加到压缩包名字的字符则不会更改。

示例:

1)使用默认的 YYYYMMDDHHMMSS 格式

rar a -ag backup

2)使用 DD-MMM-YY 格式

rar a -agDD-MMM-YY backup

3)使用 YYYYMMDDHHMM 格式

rar a -agYYYYMMDDHHMM backup

4)使用 YYYY-WW-A 格式

rar a -agYYYY-WW-A backup


-ao 添加有”存档“属性设置的文件 (仅 Windows 版本有效)。

示例:

添加驱动器 C: 上具有“存档”属性的所有文件到“f:backup”压
缩包并清除文件的“存档”属性


rar a -r -ac -ao f:backup c:/*.*


-ap 设置压缩包的内部路径。当添加文件到压缩包时,这个路径合并到
文件名,当解压缩时,从文件名中删除。

举例来说,如果您希望将文件 readme.txt 添加到压缩包 release
的文件夹 DOCS/ENG下,您可以运行:

rar a -apDOCS/ENG release readme.txt

或解压缩 ENG 到当前文件夹:


rar x -apDOCS release DOCS/ENG/*.*


-as 同步压缩包内容

如果这个选项在压缩时使用,压缩包里的文件,如果在当前添加的
文件名单中未出现的,则会从压缩包中删除。它可以与 -u 选项结
合,非常方便的同步压缩包及被压缩的文件夹的内容。

举例来说,在下面命令之后:

rar a -u -as backup sources/*.cpp

压缩包 backup.rar 将只包含 sources 文件夹下面的所有 .cpp 文
件,所有其他的文件会从压缩包中删除。这看起来好像创建新的压
缩包,但有个重要的例外: 如果从上次备份后没有修改过文件,这
个操作会比创建新压缩包快得多。


-av 放置身份验证(注册版有效)。
RAR 将会在每一个新建及更新的压缩包里放置关于创建者、最后的
更新时间和压缩包名称信息。

如果压缩包包含身份验证,在修改中未指定这个选项时,原身份验
证信息将会被删除。

当解压缩,测试,列出或更新有 '-av' 选项的压缩包的时候,RAR
将会运行完整性验证并显示信息:

正在检验认证信息 ...

在成功进行身份验证后,将会显示“成功”信息,创建者和最后的
更新资料。在身份验证失败的情况下,将会显示“失败”信息 。

这个身份验证的 '-av,' 特性,推荐用于软件发布情况下的压缩包。

为了启用身份验证特性,软件必须注册。请联系您当地的销售地点
或全球发布中心。


-av- 禁止检查或者添加身份验证。


-cfg- 禁止读取配置文件和环境变量。


-cl 将文件名转换为小写。


-cu 将文件名转换为大写。


-c- 禁止显示注释。


-df 压缩后删除源文件。

将文件移动到压缩包。此选项与命令 a 配合使用,则执行和命令 m
相同的操作。


-dh 打开共享的文件。

允许处理其他应用程序正在打开进行写操作的文件。

此选项具有危险性,因为它允许添加其他应用程序正在修改的文件
到压缩包,请小心使用。


-ds 添加到固实压缩包时不将文件排序。


-ed 不添加空目录

此选项表示,不将空目录保存到压缩包。


-ee 不处理扩展属性

禁用保存和恢复文件扩展属性。仅对 OS/2 版本有效。


-en 不添加“压缩包结束”块

默认情况下,在新建或更新的压缩包的结尾,RAR 会添加“压缩包
结束”块。这样允许安全地跳过外部数据如数字签名等,但是在一
些特殊的情况下禁用该特性会变得很有用。例如,如果通过不可靠
的连接,在两个系统间传输一个压缩包,发送同时发送者在压缩包
里添加了新文件,可能很重要的一点是,确保在传输过程中已经接
收的部分不会被另一端所修改。

这个选项不能用于分卷文件,因为压缩包的结束部分包含着正确处
理分卷文件的重要信息。


-ep 从名称中删除路径。此选项允许在添加文件到压缩包时不包含路径
信息。当然,这可能会在压缩包中存在多个同名的文件。


-ep1 从文件名中删除底层目录。不保存在命令行上输入的路径。

示例:

所有 tmp 目录下的文件和目录将会添加到 'test' 压缩包,但是压
缩包里的文件名不包含路径 'tmp/'

rar a -ep1 -r test 'tmp/*'

这相当于命令:

cd tmp
rar a -r ../test
cd ..


-ep2 扩展路径到完整路径。在压缩时存储完整文件路径(不包含驱动器和
前导的路径分隔符)。


-e<atr> 指定要排除的文件的文件属性掩码。<atr> 是十进制、八进制(以
'0' 前缀)或十六进制(以 '0x' 前缀)格式的数字。如果对 <atr>
和文件属性按位进行 AND 逻辑运算的结果非零, 那么这个文件将不
会添加到压缩包。

在 Windows 版本下,也可以使用代替数字掩码的 D、S、H、A 及 R
符号来表示目录及文件的系统、隐藏、存档和只读属性。属性的先
后顺序并不重要。


-f 更新文件。可用于压缩包的解压缩或者创建时。命令字串 “a -f”
等同于命令 'f'。您也可以将选项 “-f” 和命令 'm' 或命令
'mf' 一起使用。如果选项 “-f” 用于命令 'x' 或 'e',则只有
旧文件会被从压缩包里释放出来的新版本所代替。

-hp[p] 文件数据和文件头全部加密。

这个选项和 -p[p] 很相似,但是选项 -p 只加密文件数据,而保留
象文件名等其他信息可见。这个选项加密包括文件数据、文件名、
文件大小、文件属性、注释和其他数据块等所有敏感的文档区域。
所以他提供了更高的保密级别。使用了 -hp, 没有密码甚至连压缩
包的文件列表都无法看到。

例如:

rar a -hpfGzq5yKw secret report.txt

使用密码 'fGzq5yKw' 将文件 report.txt 添加到加密压缩包
secret.rar 里。


-idp 禁止百分比指示器。

将输出重定向到文件时,可能相当有用。


-ieml[.][地址]
通过电子邮件发送压缩包。仅对 Win32 版本有效。

为电子邮件添加由更新或新建所建立的压缩包做为附件。您必须有
兼容 MAPI 的电子邮件客户程序来使用这个选项(目前大部分的电
子邮件应用程序都支持 MAPI 接口)。

您可以在选项里直接输入收件人的电子邮件地址或是留空,后一种
情况下,您的电子邮件程序会提示您输入。

如果您在 -ieml 后面加一个'.'字符,在成功附到电子邮件后,将
会删除压缩包。如果在分卷压缩时使用了这个选项,那么每一个分
卷文件将会附加到独立的电子邮件上。用分号或逗号字符分隔可以
寄给多个电邮。


-ierr 发送所有的信息到 stderr。


-ilog[name]
记录错误到文件(注册版才有效)。

写入错误信息到 RAR 目录下的 rar.log 文件里,也可以在选项里指
定另一个日志文件名来代替默认的 rar.log,例如:
-ilogc:/log/backup.log, 如果指定的文件名不包含路径,则在 RAR
目录下创建日志文件。


-inul 禁止全部的信息。


-isnd 启用音效。


-k 锁定压缩包。任何更改压缩包的命令将被忽略。


-kb 保留损坏的解压缩文件。

RAR 在默认情况下,会删除解压缩出现 CRC 错误的文件,选项 -kb
则指定不删除有 CRC 错误的文件。


-m<n> 设置压缩方式:

-m0 存储 添加文件到压缩包不做压缩
-m1 最快 最快速的方式(较少的压缩)
-m2 较快 快速压缩方式
-m3 标准 常规压缩方式(默认)
-m4 较好 较好的压缩方式(较高的压缩,较慢)
-m5 最好 最好的压缩方式(最高压缩,速度最慢)

如果这个选项未指定,RAR 使用“-m3”方式(常规压缩)。

默认情况下,RAR 在 -m1 和 -m2 方式下只使用常规压缩算法,高
级算法象音频和真彩色压缩只在 -m3 到 -m5 方式下启用,高级文
本压缩只在 -m4,-m5下启用。这些默认值可以通过 -mc 选项改变。


-mc<参数>
设置高级压缩参数

这个选项主要用于基准测试 (benchmark) 和试验,通常在真实环境
下,最好让 RAR 自动选择最佳的参数。请注意,不正确地使用这个
选项可能会引起非常严重的性能和压缩比下降,所以只有你完全明
白怎么做的情况下,才使用这个选项。

语法如下:

-mc[参数1][:参数2][模块][+ 或 -]

这里<模块>是一个特征域表示已经被设置好的一部分压缩算法。

它的值如下:

A - 音频压缩;
C - 真彩色 (RGB) 数据压缩;
D - delta 压缩;
E - 32位 x86 Intel 可执行程序压缩;
I - 64位 Intel Itanium 可执行程序压缩;
T - 文本压缩。

选项末端的'+'符号,表示应用所选的算法模块来处理所有的数据。
而 '-' 符号则禁用该模块。如果没有指定符号,那么 RAR 将会根
据数据和当前的压缩算法自动选择模块。

选项 -mc- 禁用所有可选的模块,只允许常规的压缩算法。

<参数1>和<参数2>根据模块而决定的参数,其描述如下:

音频压缩,delta 压缩:

<参数1> 是通道的字节数(可以是 1-31)。
RAR分离多字节通道为单字节,例如,RAR 把两个 16位的音频通道
当作四个单字节的通道。

<参数2> 忽略。


32位 x86 Intel 可执行程序压缩,
64位 Intel Itanium 可执行程序压缩,
真彩色 (RGB) 数据压缩:

<参数1> 和 <参数2> 都忽略。


文本压缩:

<参数1> 是 PPM 算法的阶数 (可以是2-63)。
通常高一些的值可以稍微提高冗余数据的压缩比,但是只有给 PPM
提供充足内存才可以。内存不足的情况下,可能会起反作用。过高
的阶数会降低压缩和解压缩的速度。

<参数2> 以兆为单位分配给 PPM 算法的内存(1-128)。

高一些的值可以提高压缩比,但是要注意在压缩和解压缩时 PPM 将
使用同样大小的内存空间,所以如果你在创建压缩包时,分配太多
的内存空间的话,别人在拥有较少内存的电脑上解压缩该压缩包时,
可能会有问题。解压缩虽然可以通过使用虚拟内存进行,但是可能
会变得很慢。

示例:

1) 选项 -mc1a+ 对所有数据强制使用 8位单声道音频压缩算法。

2) 选项 -mc10:40t+ 强制对所有数据使用文本压缩算法,设置压缩
阶数为 10 并且分配 40MB 的内存空间。

3) 选项 -mc12t 设置文本压缩算法使用的阶数为12,并且由 RAR
决定何时使用该算法。

4) 选项 -mct- -mcd- 表示禁用文本和 delta 压缩算法。


-md<n> 这个选项允许用 <n> Kb 来选择压缩字典大小。<n> 必须是 64、
128、256、512、1024、2048 或 4096, 或用字母'a'、'b'、'c'、
'd'、'e'、 'f' 或 'g' 表示。

滑动字典是用于压缩算法的特殊内存区域。如果被压缩的文件大小(
或者固实压缩包的总计文件大小)比字典大,那么增加字典大小通常
会增加压缩比、降低压缩的速度和增加内存需求。

如果字典明显比压缩的源数据大,RAR 可以降低字典的大小。这有
助于不降低压缩比的情况下减少所需的内存。

默认的 RAR 滑动字典大小是 4096 KB。

示例:

RAR a -s -mdd sources *.asm



RAR a -s -md512 sources *.asm

将会使用 512 KB 的字典创建固实压缩包。


-ms[列表]
指定只存储的文件的文件类型。

指定文件类型,这些文件只储存不压缩。这个选项可以用来存储已
经压缩过的文件,有助于提高压缩速度,不会有明显的压缩比损失。

可选的 <列表> 参数定义用分号隔开的文件扩展名列表。例如,
-msrar;zip;jpg 将会强迫 RAR 不压缩只存储所有的 RAR 和 ZIP
压缩包以及所有的 JPG 图像。列表也允许使用通配符,因此
-ms*.rar;*.zip;*.jpg 也一样。

如果没有指定 <列表>,-ms 选项将使用默认的文件扩展名集合,包
括如下的文件类型:

ace, arj, bz2, cab, gz, jpeg, jpg, lha, lzh, mp3, rar, zip,
taz, tgz, z


-ol 存储符号链接当成文件的替代链接(Save symbolic links as the
link instead of the file)。只在 Unix 版本有效。


-os 存储 NTFS 数据流,只在 Win32 版本有效。

这个选项意味着只能在 Windows NT 的 NTFS 文件系统下使用,并
允许存储与文件相关联的交替数据流。在 Windows 2000 下面尤其
重要,它使用流来保存某些文件附加信息,如文件描述。如果您使
用 RAR 来备份您的 NTFS 磁盘时,建议您使用这个选项。


-ow 在压缩中存储文件安全信息和解压缩还原它的时候,使用这个选项。

Unix 的 RAR 版本在使用这个选项时则保存文件属主和组信息。

Win32 的 RAR 版本在使用这个选项时则保存文件拥有者、群组,文
件访问权限及统计信息,但是只有在您有足够的权利来读取这些信
息时才有效。注意只有在 Windows 下的 NTFS 文件系统支持基于文
件的安全。


-o+ 替换存在的文件。


-o- 不替换存在的文件。


-p<p> 在压缩的时候,用字串 <p> 作为密码给文件加密。密码是大小写敏
感的。如果你在命令行上省略密码,您将会被提示 “输入密码”

示例:

rar a -pmyhoney secret1 *.txt

添加文件 *.txt 并用密码 "myhoney" 加密。


-p- 不询问密码


-r 包含子文件夹,可以用于命令: a, u, f, m, x, e, t, p, v, l,
c, cf 和 s。

当和命令 'a', 'u', 'f', 'm' 一起使用时,将处理当前文件夹和
所有子文件夹下面的所有文件。

当和命令 x, e, t, p, v, l, c, cf 或 s 一起使用时,将处理当
前文件夹和所有子文件夹下面的所有压缩包。


-r0 与选项 -r 相似,但是和命令 'a', 'u', 'f','m' 一起使用时,只
包含那些名字包含通配符“*”和“?”的子文件夹。


-ri<p>[:<s>]
设置优先级及休眠时间。只适用于 Windows 下的 RAR 。这个选项
在多任务环境下,用于调整 RAR 的系统负荷。可用的任务优先级从
0 到 15。当 <p> 等于 0 时,使用默认的优先级。1 对应最低的任
务优先级,15 - 最高。休眠时间 <s> 是从 0 到 1000 (毫秒)的数
值。这是在压缩或解压缩操作时每一次读写后留给系统的时间片。
在系统中运行着许多具有相同优先级的任务时,这个休眠时间设置
很有用。

示例:

用默认优先级执行 RAR 并且每次读写后休眠 10 毫秒

rar a -r -sfx -ri0:10 backup *.*


-rr[N] 添加数据恢复记录。这个选项用于创建或修改压缩包时,添加数据
恢复记录到压缩包。
参阅 'rr[N]' 命令描述获得详细帮助。


-rv[N] 创建恢复分卷文件。这个选项用于在创建或修改多重分卷压缩包时,
生成恢复分卷。
请参阅 'rv[N]' 命令获取详细帮助。


-s 创建固实压缩包。固实压缩是一种特殊的压缩类型,请参阅附录
“术语表”获得进一步的信息。

示例:

创建固实压缩包 sources.rar, 使用 512 KB 字典,包含全部子目
录,从当前目录开始,只添加 .asm 文件:

rar a -s -md512 sources.rar *.asm -r


-s<N> 根据文件计数创建固实组

和 -s 相似,但是压缩 <N> 个文件之后复位固实统计数据。通常会
降低压缩比,但是在固实压缩包损坏的情况下减少数据的丢失。


-se 根据文件扩展名创建固实组

和 -s 相似,但是在扩展名变更时复位固实统计数据。通常会降低
压缩比,但是在固实压缩包损坏时能减少数据的丢失。


-sv 创建独立的固实压缩分卷

默认情况下,只要一开始新分卷的压缩,RAR 就会试着复位固实统
计数据,但是只有在上一次复位后,又压缩了足够多的数据(至少
数兆字节),才会执行。

这个选项强制 RAR 忽略压缩过的数据大小和试图复位任何大小分卷
文件的统计数据。这会降低压缩比,但是在压缩分卷集的分卷丢失
或是损坏时,增加解压缩部分数据的机会。

注意,在某些情况下即使用了这个参数,RAR 也不能重置统计数据。
例如,在压缩一个大文件并分割到几个分卷文件时,这个参数不能
执行。RAR 只能在不同的文件之间复位固实统计数据,在单个文件
内则不能这样。

如果不是创建分卷压缩,选项忽略。


-sv- 创建从属的固实压缩分卷

在分卷压缩时,禁止复位固实统计数据。

这样会稍微增加压缩比,但是会严重降低压缩分卷集的分卷丢失或
损坏时,解压缩部分数据的机会。

如果不是创建分卷压缩,选项忽略。


-s- 禁止固实压缩


-sfx[名称]

创建自解压包。创建新压缩包时,如果使用这个选项,将会创建自
解压包(使用文件 default.sfx 或者选项中指定的模块)。Windows
版本的 default.sfx 应该放在 rar.exe 相同的目录下。Unix - 放
在用户的 home 目录、/usr/lib 或 /usr/local/lib下。

示例:

rar a -sfxwincon.sfx myinst

使用 wincon.sfx 自解压模块创建自解压包


-t 压缩后测试压缩包文件。在和移动命令联合使用时,这个选项特别
有用,因为只有在压缩包成功测试后,才会删除文件。


-ta<日期>
只处理指定日期后修改的文件。

日期字符串格式:YYYYMMDDHHMMSS
在日期字符串中,允许插入分隔符如 '-' 或 ':' ,并且可以省略
后面的部分。例如,下列的选项是正确的:-ta2001-11-20 在内部,
它会被扩展为 -ta20011120000000,按“2001年11月20日0时0分0秒
后修改的文件”处理。


-tb<日期>
只处理指定日期前修改的文件。
选项的格式同 -ta<日期>。


-tk 保留原始的压缩包时间。在修改压缩包时,防止 RAR 修改压缩包时
间。


-tl 设置压缩包为最新文件的时间。强制 WinRAR 用压缩包内最新文件
的时间来设置压缩包的时间。


-tn<时间> 处理特定时间段内的新文件。时间字串的格式为:

[<日>d][<时>h][<分>m][<秒>s]

例如,使用选项 -tn15d 来处理最近 15 天的新文件,而
-tn2h30m 则处理最近 2 小时 30 分内的新文件。


-to<时间> 处理比指定时间段还旧的文件,选项格式和 -tn<时间> 相同。


-u 更新文件。可以用于压缩包的解压缩和创建。命令串 "a -u" 等同
于命令 'u',您也可以和命令 'm' 或 'mf' 一起使用 '-u' 选项。
如果选项 '-u' 和命令 'x' 或 'e' 一起使用,则只解压缩磁盘上
没有的或更新的文件。


-v<size>[k|b|f|m|M]
使用等于 <size>*1000 [*1024 | *1] 的分卷大小创建分卷压缩。
默认情况下,这个选项使用1000 作为千字节(而不是 1024 字节)。
您也可以使用符号 'k' 来输入按KB(1024字节)计算的分卷大小,
或者用符号'b' 表示字节,用'm' 表示MB(1024 x 1024),而'M'表
示1000000字节。或者使用符号 'f' 加数字选择一些预定义的值。
预定义的值有 360、720、1200、1440 或 2880并且会替换到和软盘
大小一致。

如果省略了大小,将会使用自动检测。

如果在可移动介质上创建分卷,在第一个分卷被创建后,用户被提
示:

创建下一个分卷: Yes/No/All

这时,您应该更换磁盘。回答 'A' 会导致创建全部的分卷而不再暂
停。

默认情况下,RAR 分卷使用象 'volname.partNNN.rar'这样的名字,
这里的 NNN 是分卷号。使用 -vn 选项可以换到另一种,基于扩展
名的方案,这种情况下分卷集的第一个分卷扩展名是 .rar,后继的
分卷按 .r00 到 .r99 编号。

当解压缩或测试多分卷的压缩包时,您必须使用第一个分卷文件的
名称。如果使用可移动磁盘,驱动器内没有下一个分卷时,用户会
被提示:

请插入装有 <下一个分卷名> 的软盘。

插入装有正确分卷的磁盘并按任意键


如果解压缩过程中,分卷文件放在非移动磁盘上,找不到下一个分
卷时,RAR 将会放弃操作并显示错误信息:

未找到 <分卷名>

分卷压缩包是无法修改的。命令 'd'、'f'、'u'、's' 不能用于分
卷压缩集合。命令 'a' 只能在创建新的分卷压缩时使用。

尽管不太可能,多分卷压缩包的大小可能会大于未压缩的文件大小。
这是因为“存储”(如果大小增加则不压缩)不能够在分卷压缩中
启用。

压缩分卷可以是多分卷自解压包,这样的压缩包可以同时使用 '-v'
和 '-sfx' 选项来创建。

示例:

以固定的分卷大小创建压缩包:

rar a -s -v1440 floparch.rar *.*

将会创建 1440000 字节大小的固实压缩分卷。


-vd 创建分卷压缩前清除磁盘内容

在使用 '-vd' 时,所有目标磁盘上的文件和文件夹将会被删除。这
个参数只适用于可移动介质,使用这个参数不能清除硬盘。


-ver[n] 文件版本控制

在更新已经存在的压缩包内的文件时,强制 RAR 保留以前的文件版
本。旧版本的文件被重命名为 'filename;n',这里 'n' 是版本号。

默认情况下,在不带选项 -ver 解压缩时, RAR 只解压缩那个不包
括数字后缀的,最后添加的版本的文件。但是,如果您指定一个包
括版本的,确切的文件名,那么这个文件将会解压缩。例如,
'rar x arcname' 将会只解压缩最新的版本,而
'rar x arcname file.txt;5' 将会解压缩 'file.txt;5',如果文
件在压缩包内存在的话。

在解压缩时,如果您不带任何参数使用 -ver 选项,RAR 将会解压
缩符合文件过滤条件的所有文件的所有版本。这种情况下,文件版
本号不会从解压缩的文件名中删除。您也可以通过将版本号指定为
-ver 的参数,解压缩一个具体的文件版本。这将命令 RAR 只会解
压缩这个版本的文件并从文件名中删除版本号。例如,
'rar x -ver5 arcname' 将只解压缩第五个版本的文件。


-vn 使用旧式的分卷命名方案

默认情况下,RAR 分卷压缩包的名称象 'volname.partNNN.rar',
这里 NNN 是分卷号. 使用 -vn 选项 可以切换到另一种,基于扩展
名的命名方案,这种方案下,分卷集第一个分卷的扩展名是 .rar,
后继的分卷按 .r00 到 .r99 编号。如果您想在旧的 MS DOS 下解
压缩文件,这个参数可能有点用。因为纯 MS DOS 下文件名中 '.'
不能超过一个。


-vp 每个分卷之前暂停

默认情况下,RAR 只在可移动磁盘上,创建或解压缩下一个分卷之
前,才会要求确认。这个选项强制 RAR 始终要求这样的确认。如果
磁盘空间有限,并且您希望在每个分卷创建后立即复制到其它的媒
体时,这会相当有用。


-w<p> 分配工作目录到 <p> 。这个选项可用于为临时文件分配目录。


-x<f> 排除指定的文件 <f>。可以在文件名和文件掩码的文件部分使用通
配符。您可以多次指定 -x 选项。

示例:

1) rar a -r -x*.bak -x*.rar rawfiles

所有的 .bak 和 .rar 文件将不会添加到 rawfiles

2) rar a -r -x*/temp/* savec c:/*

压缩磁盘C:上所有文件,不包括在 temp 文件夹内的文件。


-x@<lf> 使用指定的列表文件来排除文件。

示例:

rar a -x@exlist.txt arch *.exe


-y 所有的询问都回答“是”。


-z<f> 从文件 <f> 读取压缩包注释。


限制
~~~~

路径名称最长 259 个字符。

最大压缩包注释长度 62000 字节。

命令限制:

命令 'd','u','f','c','cf' 不能用于分卷压缩。

命令 'a' 只能创建,不能更新分卷压缩包。


退出代码
~~~~~~~~

RAR 在操作成功时用代码 0 退出,非 0 的退出代码则表示操作因为错误而
取消:

255 用户中断 用户停止了程序

8 内存错误 操作时内存不足

7 用户错误 命令行选项错误

6 打开错误 打开文件错误

5 写入错误 写入磁盘错误

4 锁定的压缩包 试图修改由 'k' 命令锁定的压缩包

3 CRC 错误 解压缩时出现 CRC 校验错

2 重大错误 发生了重大错误

1 警告 没有发生重大错误

0 成功 操作成功(用户退出)


术语表
~~~~~~

压缩包 包含一个或多个压缩或加密过文件的特殊文件

压缩 一种用来减少数据大小的编码方式

CRC 循换冗余校验。计算特别的检查信息来验证数据有效性的数学
方法

SFX 执运时用来解压缩文件的压缩包模块 (SelF-eXtracting
module 自解压模块),通常是 .EXE 格式的文件

固实 使用特殊压缩方法压缩的压缩包,它把所有文件都当成一个连
续的数据流。 在压缩大量的小文件的时候,特别有利。

分卷 分割开的压缩包的一部份。将压缩包分割成卷允许将它们存储
到软盘中。固实压缩分卷必须从第一个分卷开始解压缩。



版权所有

(C)1993-2002 Eugene Roshal
 
请问 如果用户没有安装RAR的话 能不能只把这个rar.exe
拷来用,还是再包括一些什么dll
 
可以的话不妨通知我。
 
后退
顶部