command line compression program use scripting syntax examples         

command line zip program rar from command line programmatically zip files
rar program syntax zip utility syntax unzip syntax examples command line rar program programmatically unzip files command line file compression software

command line compression program

PeaZip is a free cross-platform file archiver utility that provides an unified portable GUI for many Open Source technologies like 7-Zip, FreeArc, PAQ, UPX... free alternative to WinRar, WinZip and similar proprietary software.
- Create 7Z, ARC, BZ2, GZ, *PAQ, PEA, QUAD/BALZ, TAR, UPX, WIM, XZ, ZIP files
- Open and extract ACE, ARJ, CAB, DMG, ISO, LHA, RAR, UDF, ZIPX files and more,
over 200 archive types supported
Features of PeaZip includes:
archives opener and extractor, unace, unrar, batch creation and extraction of multiple archives at once, convert files, create sfx archives, split and join files, strong encryption with two factor authentication, encrypted password manager, secure deletion, find duplicate files, calculate hash and checksum, export job definition as command line or script.

free file compression program




PeaZip command line use, program scripting syntax examples

how to zip from command line

PeaZip acts as a frontend for many Open Source archiving executables (7z / p7zip, FreeArc, unace, PAQ, LPAQ, ZPAQ, UPX...): due its frontend architecture most tasks possible to be accomplished with PeaZip GUI can be converted and exported to command line, and saved as script (batch file or shell script), using Save task definition button in Console tab (in archiving/conversion and in extraction interfaces), or console button in task's window.

rar command line examples

From the Console tab the task can be modified and tested, before being saved for future programmatical use.
Exporting GUI-defined jobs as script bridges the gap between GUI and command-line software worlds, taking the best of both: users can benefit of those saved sample scripts (main menu Tools > Saved task definition scripts points to the default PeaZip's script directory) that can be used programmatically as is, or as examples or building blocks to speed up further scripting, or for learning purpose about the underlying executables (in example build examples for backend p7zip / 7-Zip command line syntax), or for fine-tuning the task beyond the GUI's capabilities.
Exported tasks are displayed as UTF8 text and can be freely saved, in example (but not only) as
Bash shell on Unix systems, or .bat or .ps1 PowerShell script on Microsoft Windows platform.

If encryption password is needed to complete the task (batch create an encrypted archive of files, or batch extract a password protected archive), it needs to be written in the command line or script, otherwise the password will be asked interactively and the task will not run unattended - a supervisor will need to enter the password when required by the running job.
Please note very carefully that if the password is saved as plain text to a script file, it has to be protected with maximum care.

To avoid the password being saved to the .bat script,
  • for archive extraction / backup reatore tasks, simply omit to enter the password, it will be asked interactively when running the script
  • for archive creation / backup creation tasks, you can delete the password from the script prompted in Console tab, before saving it. The password switch appear in as "-pthisisthepassword", removing the password part and letting the switch as "-p" the password will be asked interactively when running the script

Microsoft Windows Vista and newer systems, Schedule tab (in archiving/conversion and extraction interfaces) is intended as a quick way to schedule (in builtin Windows system's Task scheduler) a scripted task defined in Console tab, in example to automate backup or restore job launching the saved script file(s) at user-defined times, or under specific circumstances / events.

programmatically zip files

Please note those command lines / scripts are targeted directly to backend archiver / compressor utility binaries (7-Zip / p7zip, unace, unrar, Pea, FreeArc...) so are useful for creating examples to understand and experiment the syntax of those tools.

command line zip program

PeaZip provides its own command line syntax, in order to simplify the task of script creation, offering an unified set of commands using underlying functions without having to explicitly use the syntax of backend binaries: this is the subject of following section.

Please note you need to use absolute paths (full qualified paths, also supported in UNC path form) when writing command lines or scripts for PeaZip or for backend utilities binaries; otherwise, you will need to add PeaZip's program's directory to system's paths so the OS will be able to find the proper executables to run. For listing input and output files / directories it is always recommended to use absolute paths.
Saving, or copy / pasting, task definition from console tab as shown in previous chapter can help speed up finding and writing executables, input, and output paths in absolute form. Correctness of paths saved in scripts will need to be verified, if scripts are used on a different machine.

One of the scopes of PeaZip project is offering a simple and homogeneous frontend command line interface to mask the complexity and the differences in CLI syntax of back-end executables, "converting" commands into simpler PeaZip's syntax mapping instructions for most common compression / extraction tasks.
Quick access to most used PeaZip’s functions is provided passing as first parameter a constant string value identifying the function; those methods can be used invoking PeaZip from scripts or also creating a link to PeaZip executable with the desired first parameter.


  • -add2archive: add to a new archive and open PeaZip GUI to set archive’s type and options;
    •   -add2archive-add as -add2archive, but add to existing archive (if found)
    •   -add2archive-update as previous, but update older files only
  • -add27z: add to a new .7z archive;
  • -add27zmail: add to a new .7z archive and attach it to a mail, requires compatible mail client like in exampe Outlook and Outlook Express
  • -add2separate7z: add each input to a separate new .7z archive;
  • -add2sfx7z: add to a new self extracting 7z archive (.exe);
  • -add2sfx7zmail: add to a new self extracting archive and attach it to a mail, requires compatible mail client like in example Outlook and Outlook Express
  • -add2zip: add to a new .zip archive;
  • -add2zipmail: add to a new .zip archive and attach it to a mail, requires compatible mail client like in example Outlook and Outlook Express
  • -add2separatezip: add each input to a separate new .zip archive;
  • -add2pea: add to a new .pea archive;
  • -add2crypt: add to a new encrypted .pea archive;
  • -add2split: raw split a single input file;
  • -add2wipe: securely delete selected file(s);
  • -add2compare: byte to byte compare two files;
  • -ext2browse: open (and browse if applicable) the archive(s) in PeaZip file/archive manager GUI;
  • -ext2browsepath: browse the selected folder (or its path, if a file is selected) in PeaZip;
  • -ext2main: open archive in "Archive extraction" interface, allowing to specify i/o options, password and keyfile (interactively);
  • -ext2here and -ext2folder: extract archive(s) to its own path, “folder” variant creates a new folder named after the archive;
  • -ext2to and -ext2tofolder: extract archive(s) interactively asking for output directory;
  • -ext2simple and -ext2simplefolder: simplified “blanket” extraction command for all backends, allows to specify output path as first parameter;
  • -ext2list: list archive(s) content, to quickly look what is in the archive;
  • -ext2test: test archive(s) content;
  • -ext2openpwtest requires password as paramstr(2) (always delimited) and archive’s full name as paramstr(3): try to list the archive and terminate with exit code 0 if archive is not encrypted, 1 if it is encrypted, 2 if it is non readable (corrupted or with encrypted file list), -1 if archive is not found.
  • -ext2commandprompt: open the command prompt in the selected folder (or in its path, if a file is selected)

  • -peazipreset: reset PeaZip configuration, as Options > Reset button; can resolve unexpected problems with configuration, restarting the application with factory settings
-add2archive, -ext2main and -ext2browse open the PeaZip GUI, to allow further user’s interaction

Direct batch archiving functions
-add2pea, -add2crypt, -add27z, -add27zmail, -add2separate7z, -add2sfx7z, -add2sfx7zmail, -add2zip, -add2zipmail, -add2separatezip
and direct batch extraction functions
-ext2here, -ext2folder, -ext2to, ext2tofolder, -ext2simple, -ext2simplefolder
can delete (asking for confirmation) input files as atomic operation if this policy is set in PeaZip - delete after archiving and delete after extraction checkboxes in archiving and extraction screens respectively.
As it could not be handy to have an interactive request prompt in a batch script, an alternative version for those actions not applying deletion policy after archiving/extraction is available appending “i” letter to the command: -add2peai, -add2crypti, -add27zi, -add27zmaili, -add2separate7zi, -add2sfx7zi, -add2sfx7zmaili, -add2zipi, -add2zipmaili, -add2separatezipi, and -ext2herei, -ext2folderi, -ext2toi, ext2tofolderi, -ext2simplei, -ext2simplefolderi.
Using those version of the commands, PeaZip’s delete after archiving and delete after extraction directives are explicitly ignored.

On MS Windows platforms PeaZip can also send multiple input to a single instance using semaphores and temporary files (temp files are deleted automatically but in case of any kind of problem there is a reset switch in Options > Settings first tab to remove any possible leftover), this allows the command verb to be used in static registry entries (in example in Windows systems context menu) to send multiple input to a single instance:
  • -add2multi works like -add2archive
  • -add2multi7z works like -add27z, but stays in the archiving interface until the user click "Ok" button; it can be modified in -add2multi7zfastest, *normal, or *ultra to directly set the compression to fastest, normal or ultra levels presets (the compression method used is the one defined by the user); *mail send 7z archive by mail; *encrypt create encrypted 7z archive
  • -add2multizip works like -add2zip, but stays in the archiving interface until the user click "Ok" button; likewise the previous switch it can be modified to *fastest, *normal, or *ultra compression level; *mail send zip archive by mail
  • -add2multisfx works like -add2sfx7z, but stays in the archiving interface until the user click "Ok" button
  • -ext2multi works like - ext2main
While the program's instance accepting files is open, it is possible to continue adding input from the same directory selecting objects and using context menu’s entry, as an alternative to dragging the object to the application window that might be less handy if the workspace is crowded.


  • peazip -add2zip file1 file2 directory3 will add specified objects (file1 and file2, and all content of directory3) to a .zip archive; using -add27z instead of -add2zip will perform the same task but will result in a .7z archive (-add2pea will result in a .pea archive, -add2sfx7z will result in an self extracting executable and so on).
  • peazip -ext2here archive1 will extract archive1 in its path; using -ext2folder archive1 will be extracted to a new folder named "archive1" in the same path of archive1 file
  • peazip -ext2simple archive1 somedirectory extract archive1 in "somedirectory" path

More information: batch file.bat file for Microsoft Windows and shell scriptunix shell commands Wikipedia definitions






FAQ > Tips & tricks > Compression from command line, automate programmatical use of PeaZip with scripts

Topics and search suggestions about how to use PeaZip programmatically from command line, create CLI scripts, automate and schedule batch compression and extraction tasks saved from GUI. 7Z, TAR, ZIP program syntax console shell usage and examples:
how to use peazip archiver from command line,

create file compression scripts,

use rar from batch scripts,
automate archive extraction,
save compression batch scripts,
file compression program,

programmatically zip files,

peazip command line syntax,
rar syntax examples,
how to zip from command line,
programmatically unzip,
schedule zip extraction,
create compression shell script,
file archiving program,

zip from shell,

save task as script,
export GUI job as command,

tar syntax example,

programmatically extract files,
automate backup task,
rar from shell command,

command line zip,

how to zip from batch script,
export task as command line script,

compress from command line,

create batch from gui task,
programmatically compress files,
schedule backup script,
peazip programmatical usage,
zip from console,
programmatically archive files,
Tag Cloud
apply encryption to archive files free backup utility calculate hash value command line compression how to convert existing archive files
create backup script detect duplicate files download free rar tar zip software extract 7Z files extract ARC files extract RAR files
how to extract ZIP files extraction of RAR TAR ZIP archives file split tool free file archiver download free RAR utility create GZ files
open ACE files unzip CAB files open encrypted files open TAR files create WIM files open ZIPX files portable file archiver utility
RAR file format rar command syntax .ISO secure data deletion tar syntax self extracting archives create BZ2 files .WIM work with ISO files
ZIP file format zip from command line batch create multiple archives at once how to create RAR files
batch extract multiple rar tar zip archives at once how to backup files & folders

extract rar from command line
create zip from command line
All PeaZip downloads
PeaZip for Windows 32 bit
PeaZip for Windows 64 bit
PeaZip Portable
PeaZip Linux/BSD
rar extraction script
how to work with command line
Online help
Frequently Asked Questions
More information

work with scripts
create script file
Support PeaZip project, or donate to FAO, UNICEF and UNESCO from donation page

© PeaZip srl: TOS, Privacy
Releases Feed how to use PeaZip compression programmatically from command line
PeaZip Wiki create CLI scripts for rar zip compression extraction
Developer email automate & schedule compression tasks from GUI
Search knowledge-base
programmatical 7Z TAR ZIP syntax console shell examples