Tuesday 17 March 2015

Download files online using PowerShell.

Download files online using PowerShell,


Downloading files from internet may be like pdf's, exe's, doc's, excel etc from a script can be achieved with the below simple command.

(New-Object System.Net.WebClient).DownloadFile( 'http://websitewhereyouwanttodownload.com\filename.ext ', 'c:\temp\xx.xxx')

NOTE; ensure you give the name of the file completely with extension where you want to download locally using this command.

Example;

I would like to download the VLC player from the URL http://videolan.org/

I would use the below PowerShell cmdlet to get it downloaded locally.

(New-Object System.Net.WebClient).DownloadFile( 'http://get.videolan.org/vlc/2.2.0/win32/vlc-2.2.0-win32.exe', 'c:\temp\vlc-2.2.0-win32.exe')

This would download the setup file to your temp folder.




-have fun scripting.

No comments:

Post a Comment