Chris@385: Chris@385: Set-StrictMode -Version 2.0 Chris@385: $ErrorActionPreference = "Stop" Chris@385: Chris@385: if ($args.length -ne 2) { Chris@385: echo "Usage: zip target.zip sourcedir" Chris@385: exit 2 Chris@385: } Chris@385: Chris@385: $sourcename = $args[1] Chris@385: $targetname = $args[0] Chris@385: Chris@385: $source = (Resolve-Path $sourcename) Chris@385: Chris@385: if ([System.IO.Path]::IsPathRooted($targetname)) { Chris@385: $target = $targetname Chris@385: } else { Chris@385: $target = "$pwd\$targetname" Chris@385: } Chris@385: Chris@385: echo "Compressing from $source to $target..." | Out-Host Chris@385: Chris@385: [io.compression.zipfile]::CreateFromDirectory($source, $target) Chris@385: