Call WinRAR in a program

Source: Internet
Author: User
Tags extract rar file

WinRAR E: \ rarfile.rar E: \ 'extract RAR file
WinRAR a e: \ mydir E: \ 'add RAR file

System. disnogic. process can be used to start a new process, and can be used as a parameter when a new process is started.
For Exp:
Order = "A" & newname & "& filename
Dim PS as system. Diagnostics. Process
PS = new system. Diagnostics. Process
PS. enableraisingevents = false
Dim rarfile as fileinfo = new fileinfo (rarname)
If rarfile. exists then rarfile. Delete ()
Log (rarst)
PS. Start ("rar.exe", order)

PS. createnowindow = true
'COMMAND window does not appear
'================================================ ========
Dim order as string
Dim rarname as string
Dim filename as string
Filename = "log.txt"
Rarname = "2.rar"
Order = "A" & rarname & space (1) & filename
Dim info as new processstartinfo ("rar.exe ")
Info. windowstyle = processwindowstyle. Hidden
Info. Arguments = order
Process. Start (Info)
'================================================ ========
Shell ("C: \ Program Files \ WinRAR \ winrar.exe", appwinstyle. normalfocus)

 

In the winrar's directory, there is a file named rar.exeProgram. You only need to start this program and then add the correct parameters.
Rar.exe parameters.

Usage: RAR <command>-<switch 1>-<switch n> <archive> <files...>
<@ Listfiles...> <path_to_extract \>

<Commands>
A add files to archive
C add archive comment
Cf add files comment
CW write archive comment to file
D delete files from archive
E Extract files to current directory
F freshen files in archive
I [par] = <STR> Find string in Archives
K lock Archive
L [T, B] list archive [Technical, bare]
M [f] Move to archive [files only]
P print file to stdout
R repair Archive
RC reconstruct missing volumes
Rn rename Archived Files
Rr [N] add data recovery record
RV [N] Create recovery volumes
S [name |-] convert archive to or from SFX
T test archive files
U update files in archive
V [T, B] verbosely list archive [Technical, bare]
X Extract files with full path

<Switches>
-Stop switches Scanning
AC clear archive attribute after compression or extraction
Ad append archive name to destination path
Ag [format] generate archive name using the current date
AO add files with archive Attribute Set
AP <path> set path inside Archive
As synchronize archive Contents
AV put authenticity verification (registered versions only)
AV-Disable authenticity verification check
C-Disable comments show
CFG-Disable read Configuration
CL convert names to lower case
Cu convert names to upper case
DF delete files after Archiving
DH open shared files
DS disable name sort for solid Archive
E <ATTR> set file exclude attributes
Ed do not add empty directories
En do not put 'end of archive' Block
EP exclude paths from names
EP1 exclude base directory from names
EP2 expand paths to full
EP3 expand paths to full including the drive letter
F freshen files
HP [Password] encrypt both file data and headers
IDP disable percentage display
Ieml [ADDR] Send archive by email
Ierr send all messages to stderr
Ilog [name] log errors to file (registered versions only)
Inul disable all messages
Ioff turn PC off after completing an operation
Isnd enable sound
K lock Archive
KB keep broken extracted files
M <0 .. 5> set compression level (0-store... 3-default... 5-maximal)
MC <PAR> set advanced Compression Parameters
MD <size> dictionary size in KB (64,128,256,512,102, 2048, 4096 or A-G)
MS [ext; Ext] specify file types to store
O + overwrite existing files
O-Do Not Overwrite existing files
OC Set NTFS compressed attribute
OS save NTFS streams
Ow save or restore file owner and group
P [Password] Set Password
P-do not query Password
R recurse subdirectories
R0 recurse subdirectories for wildcard names only
Rr [N] add data recovery record
RV [N] Create recovery volumes
S [<n>, V [-], E] Create solid Archive
S-Disable solid Archiving
SFX [name] Create SFX Archive
Si [name] read data from standard input (stdin)
T test files after Archiving
Ta <date> process files modified after <date> In yyyymmddhhmmss format
TB <date> process files modified before <date> In yyyymmddhhmmss format
TK keep original archive time
TL set archive time to latest file
TN <time> process files newer than <time>
To <time> process files older than <time>
TS <m, C, A> [N] Save or restore file time (modification, creation, access)
U update files
V create volumes with size autodetection or list all volumes
V <size> [K, B] Create volumes with size = * size> * 1000 [* 1024, * 1]
VD erase disk contents before creating volume
Ver [N] file version control
Vn use the old style volume naming scheme
VP pause before each volume
W <path> assign work directory
X <File> exclude specified file
X @ read file names to exclude from stdin
X @ <list> exclude files in specified list file
Y Assume yes on all queries
Z <File> Read archive comment from File

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.