Hello,
I’m trying to unzip file with 7z but i can’t do it. Below is code, can someone please help to unzip file?
#All commands after that will implicitly use the system proxy (New-Object System.Net.WebClient).Proxy.Credentials = ` [System.Net.CredentialCache]::DefaultNetworkCredentials $webpage = Invoke-WebRequest -Uri "https://www.podatki.gov.pl/vat/bezpieczna-transakcja/wykaz-podatnikow-vat/plik-plaski/" $Today = Get-date -Format "yyyyMMdd" #Variable $Today passed to $destination $destination = "C:\Users\test\Documents\Lukasz\PowerShell\Test\$Today.7z" $source = ($webpage.Links | Where-Object {$_.href -like "*$Today.7z"} | select href).href $webclient = New-Object System.Net.WebClient if (test-path $destination) {Remove-Item $destination} #check if file exist $webclient.DownloadFile($source,$destination) #download file $FileToUnzip = "C:\Users\test\Documents\Lukasz\PowerShell\Test\" + "$Today.7z" $zip = "C:\Program Files\7-Zip\7z.exe" $destination2 = "C:\Users\test\Documents\Lukasz\PowerShell\Test\" $parameters = 'x',$FileToUnzip,$destination2 Start-Process $zip -ArgumentList $parameters -Wait