简体   繁体   English

Powershell - 从文件夹中的多个 zip 文件中仅提取一个 zip 文件

[英]Powershell - Extract only one zip file from many zip files in a folder

I have a folder of many zip files and I would like to extract only one of them.我有一个包含许多 zip 文件的文件夹,我只想提取其中一个。

Let's say I only want to unzip test3.zip for example.例如,假设我只想解压缩 test3.zip。

c:\docs c:\docs

  • test1.zip测试1.zip

  • test2.zip test2.zip

  • test3.zip测试3.zip

  • test4.zip test4.zip

Code:代码:

expand-archive -path 'c:\docs\test3.zip' -destinationpath 'test3_Folder'

This is creating me a folder, but not unzipping all the files.这是为我创建一个文件夹,但没有解压缩所有文件。 Why is this not extracting?为什么这不提取? What are some ways to extract one zip of many zip files?有哪些方法可以提取多个 zip 文件中的一个 zip? Also, how could you add a password if the zip requires it?此外,如果 zip 需要密码,您如何添加密码?

Thank you for your help谢谢您的帮助

Expand-Archive is the correct command to expand a single zip archive. Expand-Archive是扩展单个 zip 存档的正确命令。 You are not doing anything wrong.你没有做错任何事。 The fact that the result does not contain the expected files may be due to a password protected zip file.结果不包含预期文件的事实可能是由于受密码保护的 zip 文件。 Keep in mind that Expand-Archive does (currently) not support password protected zip files.请记住, Expand-Archive (当前)不支持受密码保护的 zip 文件。 It has even problems if filenames are not UTF-8 encoded.如果文件名不是 UTF-8 编码,它甚至会出现问题。

You can use third party tools like the open source tool 7zip .您可以使用第三方工具,例如开源工具7zip It can also be used over the command line and it supports password protection as well as many different compression levels/methods.它也可以在命令行上使用,它支持密码保护以及许多不同的压缩级别/方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM