BandZip cmd call parameters

command line parameters

Bandizip (Bandizip.exe) and its console application (bz.exe) support the following command line parameters:

Note: It is recommended to use bz.exe, which is specially for the console and is more stable

# Bandizip.exe <archive>
# Bandizip.exe <command> [<switches>...] <archive> [<files>...] [<path_to_extract>]
# Bandizip.exe <bcommand> [<switches>...] [<files>...]

# bz.exe <command> [<switches>...] <archive> [<files>...] [<path_to_extract>]

<archive> file

Executes the default action specified in the settings. (Usually opens the archive.)

<command> command

a add file to archive
x Unzip the file with the full path
t Test file integrity
d delete file from archive
c Create new archives (or overwrite existing ones)
cd Displays the New Archive dialog
rn Rename files in archive
l list files in archive (bz only)
/cmdfile Read the command line from the specified file

<bcommand> batch command

bc Each file/folder name to zip. If a file with the same name exists, the file will be created in the form of [file name (2)] [file name (3)]. If no target folder is specified, the default target folder is the path where the original file or folder is located.
bx Extract each archive individually into the target folder. If no target folder is specified, the default target folder is the path where each file is located.
bt Test the integrity of each file

<switches> option

- do not use option
-l:<0...9> Set compression level (0: storage, 5: default, 9: max)
-r- Disable recursion (default)
-r Enable recursive subdirectories
-aoa Overwrite all existing files without prompting
-to the Skip without overwriting existing files
- me Automatically rename unpacked files
(e.g. name.txt → name (2).txt)
-sfx:"stub path" Create SFX archive and set full path to SFX STUB
(Bandizip c -sfx:"C:\Program Files\Bandizip\bdzsfx.x86.sfx" c:\out.exe c:\src.txt)
- zopfli Use Zopfil as default encoder (slow)
-p:{password} Set file password
-o:{dir} Specify target folder
Applies only to x commands and batch commands (bc, bx, bt)
-storeroot:<yes|no> -storeroot:yes  store the root directory as the archive's top-level folder
-storeroot:no  do not store the archive's top-level folder
-y All queries are yes If
no errors occur, close (un)zip window on task completion
-ex:{list} Specify a list of files to be excluded when compressing
-ex:hello.txt
-ex:"*.bak"
-ex:"*.bak;*.tmp"
-ex:*\.git
-root:{dir} Specify the root directory in the archive when compressing
(-root:top_folder)
-fmt:{fmt} Specify file format
(zip, zipx, exe, tar, tgz, lzh, iso, 7z, gz, xz)
-v:{size} Specify volume size
(-v:1000000 -v:1440k -v:100MB ...)
-cmt:{comment} Set ZIP file comment
(-cmt:Hello, -cmt:"Hello World!")
-cmtfile:{filepath} Specify path to txt file to use as ZIP file comment
(-cmtfile:mycomment.txt, -cmtfile:"c:\test\my comment.txt")
-t:NN 指定压缩时使用的 CPU 线程数
(-t:10, -t:1, -t:0)
-cp:NN 指定打开或解压文件时使用的代码页
(Bandizip x -cp:932 japanese.zip)

可用代码页举例
- Chinese Simplified: 936
- Chinese Traditional: 950
- Japanese: 932
- Korean: 949
- UTF-8: 65001
-target:auto 使用自动解压功能将文件解压到目标文件夹。
若未指定目标文件夹,则将文件解压到每个档案所在的文件夹中。
-target:name 将文件解压到目标文件夹中的档案名文件夹内。
若未指定目标文件夹,则将文件解压到每个档案所在文件夹中的档案名文件夹内。
-date 将当前系统时间插入文件路径。请参考 strftime 的语法。 

<Switches> 选项(仅用于 Bandizip)

-email 压缩并用邮件发送
-target:dlg 显示一个对话框以指定目标文件夹,并将文件解压到目标文件夹中的 档案名 文件夹中。
若使用 -o 指定了任何文件夹,则它是对话框的默认文件夹。

<switches> 选项(仅用于 bz)

-list:v 使用命令 l 时,显示文件的详细信息。
-list:s 使用命令 l 时,仅显示文件名。
-consolemode:ansi 以 ANSI 格式保存输出 txt 文件。
-consolemode:utf8 以 UTF-8 格式保存输出 txt 文件。

示例

打开档案

Bandizip.exe sample.zip

新建档案(覆盖已有文件)

Bandizip.exe c c:\sample.zip c:\src\
Bandizip.exe c c:\sample.zip c:\src1\ c:\src2\

添加文件到档案

Bandizip.exe a c:\sample.zip c:\src\sample.txt
Bandizip.exe a c:\sample.zip c:\src\sample1.txt c:\src\sample2.txt
Bandizip.exe a c:\sample.zip c:\src\*.txt c:\src\*.jpg

从档案中删除文件

Bandizip.exe d c:\sample.zip sample.txt

Bandizip.exe d c:\sample.zip *.txt

Bandizip.exe d c:\sample.zip *.tmp *.bak

解压文件到目标路径

Bandizip.exe x -o:c:\dest\ c:\sample.zip

添加文件到档案,并设置密码为 Passw0rd,无提示覆盖全部已有文件并关闭对话框

Bandizip.exe a -y -p:Passw0rd test.zip c:\src d:\src

将多个档案中的文件解压到一个文件夹中

Bandizip.exe bx -o:c:\dst a.zip b.zip c.zip

使用“自动解压”功能将文件从多个档案解压到目标文件夹

Bandizip.exe bx -o:c:\dst -target:auto a.zip b.zip c.zip

使用每个文件夹的名称(a,b c)压缩多个文件夹(a.zip b.zip c.zip)

Bandizip.exe bc a b c

指定档案的顶级文件夹

Bandizip c -root:top test.zip abc.txt

(bz.exe)创建新档案

bz c test.zip test

在档案中重命名文件

重命名 abc.txt 为 xyz.txt

Bandizip rn test.zip abc.txt xyz.txt

子文件夹内重命名 abc.txt 为 xyz.txt

Bandizip rn test.zip sub/abc.txt sub/xyz.txt

重命名 AAA.txt 为 XXX.txt 和 BBB.txt 为 YYY.txt

Bandizip rn test.zip AAA.txt XXX.txt BBB.txt YYY.txt

使用通配符解压文件

在文件名中使用通配符解压文件或测试档案

Bandizip x *.zip

Bandizip t ABC??.zip

分别压缩多个文件夹

使用每个文件夹的名称来压缩对应文件夹,并在目标文件夹中创建档案

Bandizip bc -aoa -o:d:\backup c:\src\folder1 c:\src\folder2 c:\src\folder3

c:\src\folder1 → d:\backup\folder1.zip
c:\src\folder2 → d:\backup\folder2.zip
c:\src\folder3 → d:\backup\folder3.zip

从指定文件读取并执行命令行

保存多行命令行为 TXT 文件并调用它

Bandizip /cmdfile cmdfile.txt
Bandizip /cmdfile c:/test/cmdfile.txt

路径中的空格

输入带空格的长文件名或路径时请使用引号

Bandizip t "c:\folder name\file name.zip"
Bandizip x -o:"c:\out folder\" "c:\folder name\file name.zip"

仅解压指定文件

使用文件名或通配符来获取档案中的指定文件

Bandizip x sample.zip test.txt
Bandizip x sample.zip a.txt b.txt
Bandizip x sample.zip *.jpg
Bandizip x -r sample.zip *.jpg

Guess you like

Origin blog.csdn.net/qq_20051535/article/details/128855710