wget for windows

ever wanted to use wget in Powershell? This short function allows you to wget to local directory.

function wget($urlpath){
  $directory = (get-location).path

  $filename = $urlpath.Split("/")[-1]
  $file = $directory+"\"+$filename

  $webclient = New-Object System.Net.WebClient

Simply enter the function into your current powershell session and try it out.
wget http://upload.wikimedia.org/wikipedia/en/f/f4/The_Scream.jpg

If you want to permanently have access to this command add the function to the following file: “%windir%\system32\WindowsPowerShell\v1.0\profile.ps1

For more information on Powershell profiles, read this article:

Leave a Reply