2015-11-04 47 views
-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 
+3

當您安裝winzip命令行插件時,它還會安裝一個幫助文件。您可以使用** - s **和** - yc **選項。 – Squashman

+0

那麼是什麼阻止你使用帶密碼的** - s **選項? – Squashman

+1

它給你什麼錯誤? '-spassword'是將密碼添加到zip文件的正確方法。 – SomethingDark

回答

0

不知道你做錯了。我假設你在某種程度上混淆了例子。

Zipfiles.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>