Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to download a file from a URL that looks like this:

http://pdf.example.com/filehandle.ashx?p1=ABC&p2=DEF.pdf

Within the browser, this link prompts me to download a file called x.pdf irrespective of what DEF is (but 'x.pdf' is the right content).

However using wget, I get the following:

>wget.exe http://pdf.example.com/filehandle.ashx?p1=ABC&p2=DEF.pdf
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files\GnuWin32/etc/wgetrc
--2011-01-06 07:52:05--  http://pdf.example.com/filehandle.ashx?p1=ABC
Resolving pdf.example.com... 99.99.99.99
Connecting to pdf.example.com|99.99.99.99|:80... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2011-01-06 07:52:08 ERROR 500: Internal Server Error.

'p2' is not recognized as an internal or external command,
operable program or batch file.

This is on a Windows Vista system


Edit1

>wget.exe "http://pdf.example.com/filehandle.ashx?p1=ABC&p2=DEF.pdf"
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files\GnuWin32/etc/wgetrc
--2011-02-06 10:18:31--  http://pdf.example.com/filehandle.ashx?p1=ABC&p2=DEF.pdf
Resolving pdf.example.com... 99.99.99.99
Connecting to pdf.example.com|99.99.99.99|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4568 (4.5K) [image/JPEG]
Saving to: `filehandle.ashx@p1=ABC&p2=DEF.pdf'

100%[======================================>] 4,568       --.-K/s   in 0.1s

2011-02-06 10:18:33 (30.0 KB/s) - `filehandle.ashx@p1=ABC&p2=DEF.pdf'
 saved [4568/4568]
share|improve this question

1 Answer 1

up vote 2 down vote accepted

Put the address in quotes, i.e.:

wget.exe "http://pdf.example.com/filehandle.ashx?p1=ABC&p2=DEF.pdf"

share|improve this answer
    
Hi @ultrasawblade - please see Edit1 - it didnt download the file properly –  siliconpi Feb 6 '11 at 5:11
    
@matt_tm: You will need to use -O and specify the output filename. –  Dennis Williamson Feb 6 '11 at 10:09
    
@Dennis - it looks like the wrong option - " -o, --output-file=FILE log messages to FILE.". I tried it of course and got the log messages redirected there... –  siliconpi Feb 6 '11 at 12:55
    
@Dennis - its weird, I tried -O (capital "oh") and it didnt work exactly. It downloaded some 5k bytes into an invalid PDF which when I opened it in notepad, showed up as chinese characters on my system. –  siliconpi Feb 6 '11 at 13:55
    
What does the file utility say when you run it on that file? If you load that URL in a browser, do you get a valid PDF? –  Dennis Williamson Feb 6 '11 at 15:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.