1

Does anybody know syntax for wget command in windows. I tried its basic syntax but the problem is file gets downloaded in the directory on which I have opened command prompt. I want to know whether we can explicitly specify destination in its command. If possible then let me know that would be much helpful for me.

Mahesh
  • 39
  • 1
  • 4
  • 9
  • This is also related to this thread [WGET: How to specify the location with Wget?](http://stackoverflow.com/questions/1078524/wget-how-to-specify-the-location-with-wget?rq=1) – BlakBat Jun 13 '12 at 22:42

3 Answers3

1

If anyone reading this wants to save files downloaded to a directory, use "-P".

Example:

wget LINKHERE -P %USERPROFILE%/Downloads

This saves whatever is served by your link to C:\Users\username\Downloads.

bob_flem
  • 74
  • 6
1

According to the manual -O, --output-document=FILE write documents to FILE.

So you must give a file name after a valid directory as such:

C:\cronjobs>wget -q -O C:\Users\Public\Documents\tmp1.txt "http://google.com/"

note: -q option is to say quiet but -O is to say save file to a given file name and it will work!

Dung
  • 19,199
  • 9
  • 59
  • 54
0

Sure you can.

Use the -O syntax, and the path to use.

I've just tested this with:

C:\users\julien>wget google.com -O "C:\here.html"

And "here.html" was google's index page on the root of my "C:" drive

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
BlakBat
  • 1,835
  • 5
  • 17
  • 21
  • btw, "-O" is the shorthand for the "--output-document" flag – BlakBat Jun 13 '12 at 22:39
  • Thanks for your help I tried it on my machine but it is showing permission denied error. Will you please suggest me how to pass credential through command. – Mahesh Jun 13 '12 at 22:49
  • Are you sure the path you provided is writable by your current user? – BlakBat Jun 13 '12 at 23:10
  • yes, path which I used is writable if I tried C:\users\Mahesh>wget http://anyurl/index.html then it works on my machine but if i tried with -O option then it is giving me error. – Mahesh Jun 13 '12 at 23:22
  • 1
    Hi blakBat. it has been resolved now. I just gave directory path for destination rather than absolute path with file name thats why it was showing permission denied I guess. – Mahesh Jun 13 '12 at 23:32