0

批处理文件缩进以将 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\

我的代码如下所示:

  1. 我要求输入 zip 文件名、提取文件夹名称、目标和目标路径以及来自用户的日志文件路径

for /R "%destinationPath%" %%I in (%zipFileNamee%.zip") do ( echo %%I >> %LogFile% "%ProgramFiles%\WinZip\WinZip64.exe" -e" %%~dpI" "%destinationPath%\%extractFolder%\" >> %LogFile%

我知道还有其他实用程序可以执行此操作,例如 7zip。最好使用winzip或7zip。

4

1 回答 1

0

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

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

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

干杯!!

于 2014-03-21T09:41:26.900 回答