gpt4 book ai didi

powershell - Expand-Archive 奇数错误

转载 作者:行者123 更新时间:2023-12-02 04:28:41 29 4
gpt4 key购买 nike

我正在尝试获取 Autodesk Revit 文件中的一些数据,这只是皮肤下的 ZIP。我可以使用 7zip 进行提取,但我希望使用所有原生 PS 或 Windows 来自动化处理。在将 RVT 文件重命名为 ZIP 后,我尝试了 Expand-Archive,但 Expand-Archive 出现了一个奇怪的错误。代码是

Expand-Archive -path:'C:\RevitVersionTest\22-PLUMB-CLR-RECTANGULAR.zip' -destinationPath:'C:\Revit Fam'
错误是

New-Object : Exception calling ".ctor" with "3" argument(s): "End of Central Directory record could not be found."

最佳答案

该文件已损坏。重新下载(或获取)ZIP 文件。

背景:我在通过私有(private)链接从 Google Drive 下载 ZIP 时遇到了同样的错误:

Invoke-WebRequest -Uri $zipFile -OutFile "$destPath\myZip.zip"

...然后使用 command :
Expand-Archive c:\a.zip -DestinationPath c:\a` 

文件已下载,但无法提取。我使用 UI 通过浏览器下载,然后比较下载文件的大小。果然,下载的 ZIP 已损坏。当我将 URL 更新为 Google Docs link directly to the file (经许可公开),然后正确下载并解压缩 ZIP。

因此,在暗示文件损坏的问题下的评论是正确的。

关于powershell - Expand-Archive 奇数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50978138/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com