自动化zip存档

时间:2014-07-08 15:11:06

标签: powershell zip 7zip

因此,我尝试将文件处理为单独的备份文件,但是这会将一个名为数组中最后一个文件的存档。我不确定我在这里缺少什么。

$process = "C:\Program Files (x86)\7-Zip\7z.exe"
$destinationdir = "M:\WIP\OUT\"
$sourcedir = "M:\WIP\ZIP\"
$password = "password"
$ziplist = get-childitem $sourcedir
foreach ($zip in $ziplist)
{$destinationfile= $zip+".zip"
Start-Process $process -ArgumentList "a $destinationfile $zip -o$destinationdir    -p$password"-NoNewWindow -Wait
}

1 个答案:

答案 0 :(得分:0)

更改

 $destinationfile= $zip+".zip"

$destinationfile= $zip.FullName+".zip"