How to Download to a Specific Directory using Wget for Windows Tips, Tricks and Tutorials 26 APR 2010

The Wget for Windows application is of course exactly that: the classic GNU/Linux wget application built for Windows command line usage.

Of course, this means that most if not all command line switches are still available to you, just as what they would be had you been running the latest wget from your Linux distro of choice.

The question I’m answering today is how to specify which directory wget is to save what it is downloading to.

Normal usage sees wget placing whatever it grabs in the directory from which it is called.

You can of course specify a specific file to which to save your downloaded web page when downloading a single page by making use of the -O switch, resulting in something that looks like this:

"C:\\wget.exe" -O "C:\\downloadpage.txt" ""

If however we want to specify the directory to which wget must save its downloaded content to, we need to make use of the -P switch, which the results in a call looking like:

"C:\\wget.exe" -P "C:\\download" ""

So at the end of the operation specified above, we would be sitting with a file named index.html in the directory C:\\download.

And that’s how you specify to which directory wget must drag its captures down to!

Related Link:

Related Posts:

About Craig Lotter

Software developer, husband and dad to two little girls. Writer behind An Exploring South African. I don't have time for myself any more.