Skip to main content

PowerShell to install 7-Zip (Open Source file archive and compression utility).

Write-Output "Installing 7-Zip..."

$exePath = "$env:USERPROFILE\7z1604-x64.exe"
Invoke-WebRequest http://www.7-zip.org/a/7z1604-x64.exe -OutFile $exePath
cmd /c start /wait $exePath /S
Remove-Item $exePath

$sevenZipFolder = 'C:\Program Files\7-Zip'
Add-SessionPath $sevenZipFolder
Add-Path "$sevenZipFolder"

Write-Output "7-Zip installed to $sevenZipFolder."

# "Add-Path" and "Add-SessionPath" can be found here:
# https://jonlabelle.com/snippets/view/powershell/powershell-environment-path-utilities