I want to use a powershell command inside a batch file to download a file.
My code looks like that and works for just downloading the file from that specific url:
powershell "$progresspreference='silentlycontinue'; wget -uri "https://thisismyurl.com/123456" -outfile '%userprofile%\Downloads\file.zip'"
Now I want to implement echo download failed! url is invalid. & pause & goto label
if the invoke-webrequest
failed due to an invalid or expired url.
Also, since the powershell commands within the batch file get pretty long, is there a way to break up the commands?
I tried
powershell "$progresspreference='silentlycontinue' `
wget -uri "https://thisismyurl.com/123456" -outfile '%userprofile%\Downloads\file.zip'"
but that didn't work.