【问题标题】:PowerShell zip file extraction catching exceptonsPowerShell zip 文件提取捕获异常
【发布时间】:2015-10-07 10:01:46
【问题描述】:

我在 Power Shell (windows Server 2016 TP3) 中有以下代码

$zipFrom = Get-Item($zipfilepath);
$destTo=Get-Item($destination)
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfrom,$destTo)

问题是我得到了可怕的 260 字符文件限制错误。问题是我如何忽略错误并继续提取?

【问题讨论】:

    标签: .net windows powershell


    【解决方案1】:

    不幸的是,这是不可能的。您可以使用免费的 7-zip 代替,它可以解决上述问题。

    代码可能是:

    set-alias 7zip "C:\Program Files\7-Zip\7z.exe"
    
    $zipFrom = Get-Item($zipfilepath);
    $destTo=Get-Item($destination)
    7zip x $zipfrom -o"$destTo"
    

    【讨论】:

      猜你喜欢
      • 2013-06-25
      • 1970-01-01
      • 1970-01-01
      • 2014-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-01
      • 1970-01-01
      相关资源
      最近更新 更多