1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Batch Script + Wget to download web pages

Discussion in 'Programming' started by Cleptography, Sep 6, 2010.

  1. Cleptography

    Cleptography New Member

    Joined:
    Sep 2, 2010
    Messages:
    39
    Likes Received:
    7
    Trophy Points:
    0
    This simple script uses wget.exe to download and covert links from a web page.
    Wget has much more advanced options, than the one I use in this script, but it serves my general purpose.

    Code:
    @echo off
     setlocal
    
    :Check_Program_Path
    if exist "%ProgramFiles%\GnuWin32\bin\wget.exe" goto :Check_Command_ARG
    goto :ERROR_1
    
    :Check_Command_ARG
    if [%~1]==[] goto :ERROR_2
    
    :: ELSE---
    :Set_VARS
    set Use_WGET="%ProgramFiles%\GnuWin32\bin\wget.exe"
    set With_Arguments=-p --convert-links %~1
    
    :Use_WGET_2_Download_Page
    %Use_WGET% %With_Arguments%
    goto :EOF
    
    :ERROR_1
    echo.Wget.exe was not found in your path!!!
    goto :EOF
    
    :ERROR_2
    echo.No Address was specified!!!
    echo.
    echo.USAGE: DLPage google.com
    goto :EOF
     

Share This Page