blog.icewolf.ch

Let's talk about IT!
posts - 1801, comments - 295, trackbacks - 0

My Links

Archives

Post Categories

icewolf

Zip a File with Powershell 3.0

Hallo zusammen,

Mit dem folgenden Code kann man ohne zusätzliche Komponenten Files in ein ZIP Archiv packen.

Add-Type -As System.IO.Compression.FileSystem
[System.IO.Compression.CompressionLevel]$Compression = "Optimal"

#ZIP a File
[String]$ZipFilePath = "c:\temp\test.zip"
[String]$File = "c:\temp\Mailboxes.txt"
$Archive = [System.IO.Compression.ZipFile]::Open( $ZipFilePath, "Update" )
$null = [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($Archive, $file, "Mailboxes.txt", $Compression)
$archive.Dispose()

Grüsse
Andres Bohren

Print | posted on Wednesday, January 8, 2014 8:23 PM | Filed Under [ Powershell ]

Powered by:
Powered By Subtext Powered By ASP.NET