

Invoke-WebRequest -uri $DownloadUrl -OutFile $SaveToīoth scripts are basically the same thing, where one uses just one line with no variables, and the second one stores the parameters into variables such that editing the script lateron is easier, especially if this becomes part of a large script, then you can move the variables to the top of your script so you only need to search there in case you ever need to alter it.Step 2: Learn the Basics of Batch Scriptingīatch files use the same language as the command prompt. If you want to make it a bit more fancy, you could write the script as follows: The oneliner script would be: Invoke-WebRequest -uri "" -OutFile "$env:userprofile\Downloads\ChromeSetup.exe"

Powershell can do it with just one line of code (or more if you want to go fancy here.īecause I don't know the url of the file you want to download, I'll use Chrome as example, and save the file to the download folder in your user profile. In any case, Powershell is going to help a lot here. We're missing a bit of information in this post to construct a proper answer.
