Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file Zip和密码保护文件使用批处理文件-我在这个代码中遗漏了什么_Batch File_Winzip - Fatal编程技术网

Batch file Zip和密码保护文件使用批处理文件-我在这个代码中遗漏了什么

Batch file Zip和密码保护文件使用批处理文件-我在这个代码中遗漏了什么,batch-file,winzip,Batch File,Winzip,我想我在这段代码中缺少了一行用密码加密的代码 在我发布这篇文章之前,我已经添加了-s选项,但它只是失败了 @echo off pushd "S:\SourcePath" "c:\program files\winzip\wzzip.exe" -a "S:\Destination\Sample.zip" *.txt popd 不确定你做错了什么。我想你是在混淆例子 蝙蝠 @echo off pushd "S:\SourcePath" "c:\

我想我在这段代码中缺少了一行用密码加密的代码

在我发布这篇文章之前,我已经添加了-s选项,但它只是失败了

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

不确定你做错了什么。我想你是在混淆例子

蝙蝠

  @echo off
    pushd "S:\SourcePath"
    "c:\program files\winzip\wzzip.exe" -a "S:\Destination\Sample.zip" -spassword *.txt  
    popd
以及从命令行运行的输出

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

安装winzip命令行插件时,它还会安装一个帮助文件。您可以使用-s和-yc选项。那么是什么阻止您使用带有密码的-s选项呢?它到底会给您带来什么错误
-spassword
是向zip文件添加密码的正确方法。我刚刚尝试了你的密码,你知道,我用密码压缩文件没有问题。
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>