需要创建批处理文件以使用winzip可执行命令行提取zip文件夹并复制到多个位置

时间:2014-03-21 06:50:08

标签: batch-file 7zip winzip

批处理文件缩进以将zip文件从我的本地pc移动到服务器,这是现在可能的 问题是服务器上没有安装winzip,因此可以将winzip可执行文件与批处理文件一起移动,并使用其命令行将提取的文件复制到多个位置。

我的zip文件在我的本地说\ testmachine1 \ d $ \ zipfiles \ test.zip

(注意:此zip文件可能包含多个文件夹和文件)

  1. 批处理文件应该询问。

  2. 我想将文件移至\ testmachine2 \ d $ \ extractedfiles \

    \ testmachine3 \ d $ \ extractedfiles \

    \ testmachine4 \ d $ \ extractedfiles \

    ............................................... ........

    \ testmachine [XX] \ d $ \ extractedfiles \

  3. 我的代码如下所示:

    1. 我要求输入zip文件名,提取文件夹名称,目标和目标路径以及用户的日志文件路径
    2. for /R "%destinationPath%" %%I in (%zipFileNamee%.zip") do ( echo %%I >> %LogFile% "%ProgramFiles%\WinZip\WinZip64.exe" -e" %%~dpI" "%destinationPath%\%extractFolder%\" >> %LogFile%

      据我所知,还有其他工具可以像7zip这样做。它优先使用winzip或7zip。

1 个答案:

答案 0 :(得分:0)

经过长时间的尝试,我发现有一个wzunzip.exe可用作便携式。我可以将此文件与我的批处理文件一起保存,并运行以下代码以轻松解压缩文件。

    for /R "%targetPath%" %%I in (%zipFileName%.zip) do (
wzunzip -ybc "%%I" "%targetPath%\%destinationPath%\" >> %LogFile%
)

这将从文件集中找到特定文件,并将其解压缩到指定的文件夹。

干杯!!