Jump to content

batch scripting wget


Recommended Posts

I'm trying to download a complete copy of GirlGenius using wget in a batch script. I have this so far ..

for /L %%y in (2003,1,2009) do for /L %%m in (01,1,12) do for /L %%d in (01,1,31) do wget "http://www.girlgeniusonline.com/ggmain/strips/ggmain%%y%%m%%d.jpg"

My problem is that windows doesn't like the leading zeros I'm trying to put into the script. What am I doing wrong? Is there a better way .. other than installing Linux .. would this even work on Linux?

Note: I've already spent some time on SS64, and I've already tried doing this with the Firefox extension DownThemAll, but it is transposing numbers 01 instead of 10 and vice versa 10 instead of 01 giving me dupes of some files and not downloading others.

Link to comment
Share on other sites

rewrite in vbs, or call a vbs file from your batch file. if you take the call route, the vbs file could look something like this...

If Wscript.Arguments.Count = 3 Then
    strYear = WScript.Arguments.Item(0)
    strMonth = "0" & WScript.Arguments.Item(1)
    strDay = "0" & WScript.Arguments.Item(2)

    set objShell = wscript.createObject("wscript.shell") 
    objShell.Run("wget http://www.girlgeniusonline.com/ggmain/strips/ggmain" & strYear & right(strMonth,2) & right(strDay,2) & ".jpg"), 1, TRUE 
    'fail with a msgbox if you want
End If

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...