7
votes
2answers
5k views

PowerShell zip file synchronously

In a PowerShell script, I want to zip a folder before deleting the folder. I run the following (I don't remember where I found the snippet): function Compress-ToZip { param([string]$zipfilename) ...