Prerequisites:
Wscript support required
You can put both. exeand. rar.exe in the same folder.
And this folder is named "dos", or you can modify it yourself.
Code File;
(It is mainly convenient, and I am also very lazy, haha)
Save the file as a file of the same name.
Self-extracting code file
Unrar. asp
<%
Dim afterunzip, pedm, mlpath, Shell, rarcomm, retcode, CMD, comm, FSO
Unfilepath = request. servervariables ("path_info ")
<|> Response. Write mlpath
<|> Response. End
<|> Path for storing RAR. EXE and cmd. exe
Mlpath = Replace (server. mappath (unfilepath), "unrar. asp ","")
<|> Path of the decompressed File
Afterunzip = server. mappath ("dos ")&"\"
<|> Afterunzip = mlpath
<|> Rarfile to be decompressed
Pedm = server. mappath ("aaa.rar ")
Set shell = server. Createobject ("wscript. Shell ")
<|> X release a file from the full path of the file
<|> T compressed Test File
<|> O does not overwrite existing files.
<|> P: Set the password.
Rarcomm = mlpath & "cmd.exe/C" & mlpath & "rar.exe X-T-O +-p -"
Cmd = rarcomm & pedm & "& afterunzip
Retcode = shell. Run (CMD, 1, true)
%>
<|><|><|><|><|><|><|><|><|><|><|||> Compressed file code
RAR. asp
<%
Dim ylj, ywj, mlpath, Shell, rarcomm, retcode, CMD, comm, FSO
Unfilepath = request. servervariables ("path_info ")
<|> Response. Write mlpath
<|> Response. End
<|> Path for storing RAR. EXE and cmd. exe
Mlpath = Replace (server. mappath (unfilepath), "RAR. asp ","")
<|> Path of the compressed file
Afterzip = server. mappath ("dos ")&"\"
<|> Ylj = mlpath
<|> Rarfile to be compressed
Needzip = server. mappath ("aaaw.rar ")
Set shell = server. Createobject ("wscript. Shell ")
<|> X release a file from the full path of the file
<|> T compressed Test File
<|> O does not overwrite existing files.
<|> P: Set the password.
Rarcomm = mlpath & "cmd.exe/C" & mlpath & "rar.exe A-O +"
Cmd = rarcomm & needzip & "& afterzip
<|> Response. Write cmd
<|> Response. End
Retcode = shell. Run (CMD, 1, true)
%>
Change it to WinZip and provide command line reference:
WinRAR <command>-<switch> <compressed package> <file...> <decompression path>
Examples of compression and decompression
The following is an example to compare the basic compression and decompression commands of WinZip and WinRAR. Assume that the archive files are test.zip.rar and test.rar.
Task Description
WinZip WinRAR
Compressing the file content of the test directory and Its subdirectories
Wzzip test.zip test-r-p
WinRAR A test.rar test-R
Delete the *. txt file in the compressed package
Wzzip test.zip *. txt-d
WinRAR D test.rar *. txt
Refresh the files in the compressed package, that is, add files that already exist in the compressed package but are updated
Wzzip test.zip test-F
WinRAR F test.rar Test
Update the files in the compressed package, that is, add the files that already exist in the compressed package but are updated and the new files
Wzzip test.zip test-u
WinRAR U test.rar Test
Move the file to the compressed package, that is, add the file to the compressed package and then delete the compressed file.
Wzzip test.zip-r-p-m
WinRAR M test.rar test-R
Add all *. EXE files to the compressed file, but exclude files with names starting with A or B.
Wzzip test *. exe-XF *. *-xB *.*
WinRAR a test *. exe-XF *. *-xB *.*
Compress with a password
Wzzip test.zip test-S123. Note that the password is case sensitive. Open the compressed file with a password in the graphic interface and you will see the + mark (Fig. 1 ).
WinRAR A test.rar test-p123-R. Note that the password is case sensitive. Open the compressed file with a password in the graphic interface and you will see the * mark (figure 2 ).
Sort by name and display compressed package files in a brief list
Wzzip test.zip-VBN
RAR l test.rar
Lock the compressed package to prevent any modifications to the compressed package in the future.
No corresponding command
WinRAR K test.rar
Create a kb compressed package
No corresponding command
WinRAR A-v360 Test
Decompress the directory information
Wzunzip test-d
WinRAR X test-R
Extract files without directory information
Wzunzip Test
WinRAR E test
Decompress the file to the specified directory. If the directory does not exist, it is automatically created.
Wzunzip test newfolder \
WinRAR X test newfolder \
Decompress the file and confirm to overwrite the file
Wzunzip test-y
WinRAR X test-y
Decompress a specific file
Wzunzip test *. txt
WinRAR X test *. txt
Decompress the Update file of an existing file
Wzunzip test-F
WinRAR X test-F
Decompress the update files and new files of existing files
Wzunzip test-n
WinRAR X test-u
Decompress files in batches
Wzunzip *. Zip
WinRAR E *. rar