I create an array of string objects in PowerShell , which must be passed to the Xceed method zip library, which expects the string [], but each time I get an error. This makes me wonder if the PowerShell array is anything other than a .NET array. Here is the code:
$string_list = @() foreach($f in $file_list) { $string_list += $f.FullName } [Xceed.Zip.QuickZip]::Zip("C:\new.zip", $true, $false, $false, $string_list)
The error I get says: "Error adding files to zip file." If I hard code in such values, this works:
[Xceed.Zip.QuickZip]::Zip("C:\new.zip", $true, $false, $false, "test.txt", "test2.txt", "test3.txt")
Can someone help me figure this out? I donβt understand what the difference is ...
EDIT: I checked and confirmed that my $ string_list array consists of System.String objects
source share