Download file with PowerShell

Downloads and saves a file in the current working directory of PowerShell.

Can you use the previous working directory ($pwd) or change it to a fixed location: “C:\Download” or by first change the directory in PowerShell.
Examples of changing the directory:

$storageDir = $pwd

# or:

$storageDir = "C:\Downloads"


cd C:\Users\Teusje\Documents
$storageDir = $pwd


Below is the script to download a file via PowerShell. You can run it directly in PowerShell:

$storageDir = $pwd
$webclient = New-Object System.Net.WebClient
$url = ""
$file = "$storageDir\myNewFilename.jpg"

Have fun! 😉

20 thoughts on “Download file with PowerShell

  1. Pingback: Downloading files with PowerShell using the BitsTransfer module | Teusje

  2. article was just what I needed. However, pwd often means ‘present working directory’ in the *nix world, so that may be something to keep in mind, if only for the sake of posterity.

  3. pwd is “print working directory,” not “previous”. It’s the current directory,just like in unix-like shells. E.G.

    PS P:\> pwd

  4. Woww!!! Thank You!!!! And just have to finish it with Start-process $storageDir\myNewFilename if it executable thats work .. Do somebody can help me for other script?

  5. $client = New-Object System.Net.WebClient
    $client.DownloadFile($url, $path)
    (new-object System.Net.WebClient).DownloadFile( $url, $path)

  6. ※画像はイメージになりますいつでもフレッシュなフルーツをお手軽にもぎたて果実のジューシーさがうれしい、フレッシュフルーツ。メンズ ワイシャツ ブランド

  7. The English word Girl Striptease lady first appeared throughout the Middle Ages in between 1250 and 1300 CE and hot girl originated from the Anglo-Saxon word gerle (likewise spelled girle or gurle). [3] The Anglo-Saxon word gerela meaning dress or clothing product also appears to have actually been utilized as a metonym in some sense. [1]Woman has actually suggested any young unmarried woman considering that about 1530. Its very first kept in mind meaning for sweetie is 1648. The earliest recognized appearance of girl-friend is in 1892 and girl next door, suggested as a teenaged woman or young woman with a type of wholesome appeal, dates just to 1961. [4] Use for adults The word woman is often used to describe an adult female, generally a more youthful one. This usage may be considered derogatory or ill-mannered in professional or other formal contexts, just as the term young boy can be considered disparaging when applied to an adult man. Hence, this use is often deprecative. [1] It can likewise be utilized deprecatively when used to victimize children (“you’re just a lady”). In casual context, the word has favorable usages, as evidenced by its usage in titles of music. It has been utilized playfully for people acting virtua girl in an energetic style (Canadian vocalist Nelly Furtado’s “Promiscuous Girl”) or as a way of unifying females of all ages on the basis of their when having been women (American nation vocalist Martina McBride’s “This One’s for the Girls”). These favorable uses mean gender instead of age.

  8. Thanks for the advice! I had to take a break from kissing my boyfriend to read your page. I am going to follow you on Reddit. That cleared it up for me. I truly feel this site needs a great deal more attention

  9. Pingback: Windows batch file file download from a URL - ExceptionsHub

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s