On Windows there is the file 7zip.chm
in directory %ProgramFiles%\7-Zip
which is the help file of 7-Zip. Double click on this file to open the help.
On Contents tab there is the list item Command Line Version with the help pages:
- Syntax ... Command Line Syntax
- Commands ... Command Line Commands
- Switches ... Command Line Switches
The target is to compress everything in folder test
into a ZIP file with name of the folder as file name.
This could be done for example with the command line:
"%ProgramFiles%\7-Zip\7z.exe" a -bd -mx=9 -r -y -- test.zip "C:\Path to Directory\test\*"
This command line adds (a) everything in directory C:\Path to Directory\test
recursive (-r) to a ZIP file with name test.zip
in current working directory without progress indicator (-bd) using best ZIP compression (-mx=9) with assuming Yes on all queries (-y).
In other words the file test.zip
in current directory contains after execution the subdirectory main
with everything inside and the files 1.txt
and 2.xml
.