Help Needed in Batch script

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
born2achieve
Posts: 51
Joined: 16 Nov 2014 20:28

Help Needed in Batch script

#1 Post by born2achieve » 25 Feb 2015 21:19

Hi,

I have 1000 image url in my text file(sample.txt) and i want to download the images using the url. Can anyone please share with me the sample script which can do this in single shot.

Also, is there any way to reduce the size of the image into 20/20 px with png extension.

Thanks

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Help Needed in Batch script

#2 Post by ShadowThief » 25 Feb 2015 21:31

Are you able to use third-party software? cURL or wget can easily download files. The script will look something like

Code: Select all

@echo off
for /f %%A in (sample.txt) do wget %%A


Image editing is absolutely impossible with native batch, but I'm sure there are image resizers out there that can take command line arguments.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Help Needed in Batch script

#3 Post by foxidrive » 25 Feb 2015 22:05

Irfanview is free and has command line ability to resize images in all formats.

born2achieve
Posts: 51
Joined: 16 Nov 2014 20:28

Re: Help Needed in Batch script

#4 Post by born2achieve » 26 Feb 2015 06:34

Hi Shadow and Fox,

thanks for your reply . I could download the image which is hosted on external server outside of my state. but the process is slow. I enabled spider web on my machine. Is there anythinf to be done with Spider web can help me speeding up this?

The below sample only checks the only file exists.
Regular try :

Code: Select all

@echo off
for /f %%A in (Sample.txt) do D:\GnuWin32\GetGnuWin32\bin\wget-1.12.exe  %%A


With Spider Web

Code: Select all

@echo off
for /f %%A in (url-list.txt) do D:\GnuWin32\GetGnuWin32\bin\wget-1.12.exe --spider %%A

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Help Needed in Batch script

#5 Post by foxidrive » 26 Feb 2015 07:42

The number of connections and the speed of your link are factors.

Just commenting here that it's kind not to saturate the link of a site where you are leeching files from.

born2achieve
Posts: 51
Joined: 16 Nov 2014 20:28

Re: Help Needed in Batch script

#6 Post by born2achieve » 26 Feb 2015 08:37

thank you fox for the tip.

Post Reply