相关疑难解决方法(0)

Compress-Archive 命令返回“异常:流太长。”

我在这里有一个简单的脚本来存档以名称“存档”开头的日志,然后删除那些只留下存档的文件。

cd L:\

$Source =  Get-ChildItem L:\ | Where{$_.Name -match "^Archive.*\.evtx$"} |Get-ChildItem -name

$CurrentDate = get-date -Format M.d.yyyy

$Destination = "$CurrentDate.zip"

Compress-Archive -Path $Source -destinationpath $Destination

rm L:\$Source
Run Code Online (Sandbox Code Playgroud)

但是,当脚本运行时,我收到以下错误:

使用“3”个参数调用“Write”的异常:“流太长。” 在 C:\windows\system32\windowspowershell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:809 char:29
+ ... $destStream.Write($buffer, 0, $numberOfBytesRead )
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+fullyQualifiedErrorId : IOException

有什么建议?

compression powershell

5
推荐指数
1
解决办法
9146
查看次数

标签 统计

compression ×1

powershell ×1