-1
  @echo off
    pushd "S:\SourcePath"
    "c:\program files\winzip\wzzip.exe" -a "S:\Destination\Sample.zip" *.txt  
    popd 

我想我在这段代码中缺少了额外的一行来使用密码进行加密。

我在发布之前添加了 -s 选项,但它只是失败了

  @echo off
    pushd "S:\SourcePath"
    "c:\program files\winzip\wzzip.exe" -a "S:\Destination\Sample.zip" -spassword *.txt  
    popd
4

1 回答 1

0

不知道你做错了什么。我假设您以某种方式混淆了示例。

压缩文件.bat

@echo off
pushd "S:\SourcePath"
"c:\program files\winzip\wzzip.exe" -a "S:\Destination\Sample.zip" -spassword *.txt  
popd 

我的输出从命令行运行。

C:\BatchFiles\zip>dir s:\sourcepath\*.* /b
file1.txt
file2.txt
file3.txt

C:\BatchFiles\zip>zipfiles.bat
WinZip(R) Command Line Support Add-On Version 4.0 64-bit (Build 10562)
Copyright (c) 1991-2013 WinZip International LLC - All Rights Reserved


Adding file1.txt
Adding file2.txt
Adding file3.txt
Total bytes=21, Compressed=63 -> -199 percent savings.

Copying Zip file "S:\Destination\Sample.zip".


C:\BatchFiles\zip>dir s:\destination\*.* /b
Sample.zip

C:\BatchFiles\zip>cd /D S:\Destination

S:\Destination>"C:\program files\winzip\wzunzip.exe" -spassword Sample.zip
WinZip(R) Command Line Support Add-On Version 4.0 64-bit (Build 10562)
Copyright (c) 1991-2013 WinZip International LLC - All Rights Reserved

Zip file: Sample.zip


Extracting file1.txt
Extracting file2.txt
Extracting file3.txt

S:\Destination>dir /b
file1.txt
file2.txt
file3.txt
Sample.zip

S:\Destination>
于 2015-11-04T17:37:53.637 回答