You need to escape the percent symbols: wget -a log.txt --user-agent="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092416 Firefox/3.0.3" -O 2014_ES_300H_4_FWD_CVT_10000.pdf " http://print.xtime.com/jasperserver-pro/flow.html?_flowId=viewReportFlow&reportUnit=%%2Forganizations%%2Forganization_1%%2FXTIME1/REPORTS/PrintMenu01/PCN&reportLocale=en_US&LOCALE_STR=en_US&output=pdf&VARIANT=LEXUSUSA&MAKE=LEXUS&MODEL=ES%%20300H&YEAR=2014&TRIM=UNKNOWN&ENGINE_TYPE=4&ENGINE_SIZE=UNKNOWN&DRIVE_TYPE=FWD&TRANSMISSION_TYPE=CVT&MILEAGE=10000&UNITS=miles&DRIVING_CONDITION=Normal&PAGE=1 "
Should work in either .bat files or .cmd files On Sun, Oct 27, 2013 at 1:35 PM, Jesse Dedman <jded...@cobaltopr.com> wrote: > Hi, > > I am trying to download in batch pdfs that are dynamically generated on a > particular website. The wget command I am using is successful at > retrieving the data from a call from the command line. But when called > from a .bat script, wget returns the html file at the url instead. I am > using Windows 8. Version of wget used: 1.11.4.3287. > > Below I copy two examples from the log file. The first wget call was > called from batch and returned a text/html file. The second wget call was > called from cmd and returned the pdf, which is what I would like. How can > I make the batch script return the pdf file? Or alternatively, I have a > list of 1,800 different combinations of parameters I would like to call. > Does anyone have a suggestion on how to use wget in the command line to > retrieve these? > > I am new to wget, and to batch scripting. This very well may not be a > bug, but did not find any similar cases when searching mailing list. I > have also tried using the postdata argument with similar results. > > Thank you, > > Jesse > > > Log File: > > --2013-10-26 15:27:23-- > http://print.xtime.com/jasperserver-pro/flow.html?_flowId=viewReportFlow&reportUnit=ForganizationsForganization_1FXTIME1/REPORTS/PrintMenu01/PCN&reportLocale=en_US&LOCALE_STR=en_US&output=pdf&VARIANT=LEXUSUSA&MAKE=LEXUS&MODEL=ES0300H&YEAR=2014&TRIM=UNKNOWN&ENGINE_TYPE=4&ENGINE_SIZE=UNKNOWN&DRIVE_TYPE=FWD&TRANSMISSION_TYPE=CVT&MILEAGE=25000&UNITS=miles&DRIVING_CONDITION=Normal&PAGE=1 > Resolving print.xtime.com... 66.35.253.183 > Connecting to print.xtime.com|66.35.253.183|:80... connected. > HTTP request sent, awaiting response... 200 OK > Length: unspecified [text/html] > Saving to: `2014_ES_300H_4_FWD_CVT_25000.pdf' > > 0K .......... .......... .......... .......... .......... 96.0K > 50K .......... ..... 2.94M=0.5s > > 2013-10-26 15:27:24 (125 KB/s) - `2014_ES_300H_4_FWD_CVT_25000.pdf' saved > [67512] > > --2013-10-26 15:30:05-- > http://print.xtime.com/jasperserver-pro/flow.html?_flowId=viewReportFlow&reportUnit=%2Forganizations%2Forganization_1%2FXTIME1/REPORTS/PrintMenu01/PCN&reportLocale=en_US&LOCALE_STR=en_US&output=pdf&VARIANT=LEXUSUSA&MAKE=LEXUS&MODEL=ES%20300H&YEAR=2014&TRIM=UNKNOWN&ENGINE_TYPE=4&ENGINE_SIZE=UNKNOWN&DRIVE_TYPE=FWD&TRANSMISSION_TYPE=CVT&MILEAGE=10000&UNITS=miles&DRIVING_CONDITION=Normal&PAGE=1 > Resolving print.xtime.com... 66.35.253.183 > Connecting to print.xtime.com|66.35.253.183|:80... connected. > HTTP request sent, awaiting response... 200 OK > Length: 28867 (28K) [application/pdf] > Saving to: `2014_ES_300H_4_FWD_CVT_10000.pdf' > > 0K .......... .......... ........ 100% > 94.4K=0.3s > > 2013-10-26 15:30:09 (94.4 KB/s) - `2014_ES_300H_4_FWD_CVT_10000.pdf' saved > [28867/28867] > > Batch file code, running the same command in command line downloads the > pdf. > > ::echo off > > :: set the path environment variable to wget > set PATH=%PATH%;C:\Program Files (x86)\GnuWin32\bin\ > > wget -a log.txt --user-agent="Mozilla/5.0 (X11; U; Linux i686; en-US; > rv:1.9.0.3) Gecko/2008092416 Firefox/3.0.3" -O > 2014_ES_300H_4_FWD_CVT_10000.pdf " > http://print.xtime.com/jasperserver-pro/flow.html?_flowId=viewReportFlow&reportUnit=%2Forganizations%2Forganization_1%2FXTIME1/REPORTS/PrintMenu01/PCN&reportLocale=en_US&LOCALE_STR=en_US&output=pdf&VARIANT=LEXUSUSA&MAKE=LEXUS&MODEL=ES%20300H&YEAR=2014&TRIM=UNKNOWN&ENGINE_TYPE=4&ENGINE_SIZE=UNKNOWN&DRIVE_TYPE=FWD&TRANSMISSION_TYPE=CVT&MILEAGE=10000&UNITS=miles&DRIVING_CONDITION=Normal&PAGE=1 > " > > >