SoFunction
Updated on 2025-04-12

Operate WinRar with JavaScript

Save to locally

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]


The following are the relevant commands:

Task Description
 Winzip
 Winrar

Compress the file content of the directory test and its subdirectories
 Wzzip  test -r –P
 WINRAR A  test -r

Delete the *.txt file in the compressed package
 Wzzip  *.txt –d
 WinRAR d  *.txt

Refresh the file in the compressed package, that is, add files that already exist in the compressed package but are updated.
 Wzzip  test –f
 Winrar f  test

Update files in the compressed package, that is, add files that already exist in the compressed package but are updated and new files.
 Wzzip  test –u
 Winrar u  test

Move files to compressed package, that is, add files to compressed package and then delete the compressed files.
 Wzzip  -r -P –m
 Winrar m  test -r

Add all *.exe files to compressed files, but exclude files with names starting with a or b
 Wzzip test *.exe -xf*.* -xb*.*
 WinRAR a test *.exe -xf*.* -xb*.*

Encrypt password for compression
Wzzip  test -s123. Note that passwords are case sensitive. (There is no space between -s and password)
WINRAR A  test -p123 -r. Note that passwords are case sensitive. (There is no space between -p and password)

Sort by name and list the compressed package files in a brief manner.
 Wzzip  –vbn
 Rar l 

Lock the compressed package, that is, prevent any future modifications to the compressed package.
No corresponding command
 Winrar k 

Create a 360kb volume compressed package
No corresponding command
 Winrar a -v360 test

Decompress files with subdirectory information
 Wzunzip test –d
 Winrar x test -r

Unzip the file without subdirectory information
 Wzunzip test
 Winrar e test

Unzip the file to the specified directory. If the directory does not exist, it will be automatically created.
 Wzunzip test newfolder\
 Winrar x test newfolder\

Unzip the file and confirm the overwrite file
 Wzunzip test –y
 Winrar x test -y