How to download and install a file using Windows PowerShell

Home > Search > How-to
  by

The following script can be used to download and install a file using Windows PowerShell. Replace example.exe with the actual path and file name. The last line in this script uses the /verysilent switch to prevent the installer from appearing.

Write-Host " `n Please Wait . . .file is being downloaded. This should take about 1 minute. `n "

$Temp = "C:\Temp"
$webclient = New-Object System.Net.WebClient
$url = "https:/path/to/example.exe"
$file = "$Temp\example.exe"
$webclient.DownloadFile($url,$file)

Write-Host " `n Download complete. File will now be installed. `n "

start file.exe /verysilent

Write-Host " `n Install complete. Go to your list of programs to start the installed file. `n "

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments