How do I edit / create a new batch script to setup a bulk download from a series of links?

I was wondering if there is a way to automate this

The easiest way to automate this is to save the links in a file and then use for /f to process the links file.

Use the following batch file (links.cmd):

@echo off
setlocal enabledelayedexpansion
set "folder=M:\\Voot"
if not exist %folder% md %folder%
set quality=high
set livestreamer="%~dp0\tools\livestreamer\\"
for /f "usebackq tokens=*" %%i in (`type links.txt`) do (
  echo "%~dp0\tools\php5.4\php.exe" voot.php "%%i" "%folder%" "%livestreamer%" "%quality%"
  )
endlocal

Notes:

  • The links are read from a file in the same directory as the batch file, called links.txt
  • Remove the final echo in the file when you are happy that the php command is run with the correct parameters.
  • You only need to use %% with the for parameter, for example %%folder%% can be replaced with %folder%

Example usage:

F:\test>type links.txt
http://www.voot.com/shows/naagin/1/359115/yaminis-truth-is-revealed/393087
http://www.voot.com/shows/naagin/1/359115/sesha-cohorts-with-yamini/393813
http://www.voot.com/shows/naagin/1/359115/the-saviour/389235

F:\test>links
"F:\test\\tools\php5.4\php.exe" voot.php "http://www.voot.com/shows/naagin/1/359115/yaminis-truth-is-revealed/393087" "M:\\Voot" ""F:\test\\tools\livestreamer\\"" "high"
"F:\test\\tools\php5.4\php.exe" voot.php "http://www.voot.com/shows/naagin/1/359115/sesha-cohorts-with-yamini/393813" "M:\\Voot" ""F:\test\\tools\livestreamer\\"" "high"
"F:\test\\tools\php5.4\php.exe" voot.php "http://www.voot.com/shows/naagin/1/359115/the-saviour/389235" "M:\\Voot" ""F:\test\\tools\livestreamer\\"" "high"

Further Reading

  • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
  • for /f - Loop command against the results of another command.
  • type - Display the contents of one or more text files.