rem ---------------------------------------------------------------------------
rem Usage: wget-batch.bat <inputFile> <email> <password>
rem
rem <inputFile> is a plain text file that has the URL and Output Filename
rem separated by a comma (no spaces)
rem
rem Dan Iverson - 2015-06-12
rem This script takes 3 parameters: inputFile, email, password.
rem Filename is a text file with URL,Filename from the Oracle wget.sh script.
rem Email and Password are your Oracle Support login credentials.
rem
rem The script assumes you have WGET for Windows installed at
rem J:\downloads\wget
rem ---------------------------------------------------------------------------
rem Input file with "URL,Filename"
set LIST=%1
rem SSO username and password
set SSO_USERNAME=%2
set SSO_PASSWORD=%3
rem Path to wget command
set WGET=J:\downloads\wget\bin\wget.exe
rem Output directory and file
set OUTPUT_DIR=J:\Downloads
rem Location of cookie file
set COOKIE_FILE=%OUTPUT_DIR%\pum.cookies
rem Log directory and file
set LOGDIR=J:\Downloads
set LOGFILE=$%LOGDIR%\wgetlog-pumdownload.log
rem
rem End of user configurable variable
rem
rem Contact updates site so that we can get SSO Params for logging in
%WGET% --user-agent='Mozilla/5.0' https://edelivery.oracle.com/osdc/faces/SearchSoftware --no-check-certificate -o %OUTPUT_DIR%\output.txt
rem Find the Location part of the response
for /F "delims=" %%a in ('findstr "Location" %OUTPUT_DIR%\output.txt') do @set SSO_RESPONSE=%%a
rem Strip the first and last portions (split by a space character)
for /f "tokens=1,2,3 delims= " %%a in ("%SSO_RESPONSE%") do @set location=%%b
rem Create the SSO_SERVER variable (by finding the first two instances of 'p')
for /f "tokens=1-2,3 delims=p" %%a in ("%location%") do @set server1=%%a&@set server2=%%b
set SSO_SERVER=%server1%p%server2%
rem Create the SSO_TOKEN variable (by finding everything after the '=')
for /f "tokens=2 delims==" %%a in ("%location%") do @set SSO_TOKEN=%%a
set SSO_AUTH_URL=sso/auth
set AUTH_DATA="ssousername=%SSO_USERNAME%&password=%SSO_PASSWORD%&site2pstoretoken=%SSO_TOKEN%"
ECHO %AUTH_DATA%
rem The following command to authenticate uses HTTPS. This will work only if the wget in the environment
rem where this script will be executed was compiled with OpenSSL. Remove the --secure-protocol option
rem if wget was not compiled with OpenSSL
rem Depending on the preference, the other options are --secure-protocol= auto|SSLv2|SSLv3|TLSv1
%WGET% --user-agent='Mozilla/5.0' --secure-protocol=auto --no-check-certificate --post-data %AUTH_DATA% --save-cookies=%COOKIE_FILE% --keep-session-cookies %SSO_SERVER%%SSO_AUTH_URL% -O sso.txt
for /f "delims=, tokens=1,2" %%a in (%LIST%) do (
%WGET% --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=%COOKIE_FILE% --save-cookies=%COOKIE_FILE% --keep-session-cookies "%%a" -O %OUTPUT_DIR%/%%b
)
del sso.txt
pause
Download PeopleSoft Images on Windows using WGET | psadmin.io: "SO_USE"
'via Blog this'