命令行参数
Bandizip(Bandizip.exe)及其控制台应用程序(bz.exe)支持以下命令行参数:
# Bandizip.exe <command> [<switches>...] <archive> [<files>...] [<path_to_extract>]
# Bandizip.exe <bcommand> [<switches>...] [<files>...]
<archive> 压缩文件
执行在设置中指定的默认操作。(通常会打开压缩文件。)
<command> 命令
a | 添加文件到压缩文件 |
x | 用完整路径解压文件 |
t | 测试压缩文件的完整性 |
d | 从压缩文件中删除文件 |
c | 新建压缩文件(或覆盖现有文件) |
cd | <archive> 压缩文件 |
rn | 重命名压缩文件内文件 |
l | 列出压缩文件中的文件(仅用 bz) |
/cmdfile | 从指定文件读取命令行 |
<bcommand> 批处理命令
bc | 要压缩的每个文件/文件夹名称。 若存在同名压缩文件,则以【压缩文件名 (2)】【压缩文件名 (3)】的形式创建压缩文件。若未指定目标文件夹,则默认目标文件夹为原始文件或文件夹所在的路径。 |
bx | 将每个压缩文件分别解压到目标文件夹中。 若未指定目标文件夹,则默认目标文件夹为每个压缩文件所在的路径。 |
bt | 测试每个压缩文件的完整性 |
<switches> 选项
<Switches> 选项(仅用于 Bandizip)
压缩并用邮件发送 | |
-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