d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Batch File Help
Add Reply New Topic New Poll
Member
Posts: 1,160
Joined: Nov 19 2012
Gold: 250.00
Jan 5 2014 04:19pm
Hey guys. I want to create a batch file that will search a website for a string and return a string to a .txt file if true and return a different string to a different .txt file if false. Any help would be great. Thanks
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Jan 5 2014 05:09pm
you will probably need wget if your going to do this with batch
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Jan 5 2014 05:15pm
Member
Posts: 1,160
Joined: Nov 19 2012
Gold: 250.00
Jan 5 2014 05:40pm
I see, ya!

Ultimately Id like to have an array of words to look for and cycle through them one by one with two output files (one for results found and one for results not found)
Member
Posts: 1,160
Joined: Nov 19 2012
Gold: 250.00
Jan 5 2014 07:19pm
I was able to get WGet to download the text of a website. Now I am trying to search the txt file for strings and then output the string I am searching into a found or not found file... this is my code

@echo off
findstr /c "Justicar Aatrox" elophant.txt
if %errorlevel%==0 (
echo Justicar Aatrox >> skinsOwned.txt
) else (
echo Justicar Aatrox >> skinsNotOwned.txt
)

It is returning Justicar Aatrox into skinsOwned despite it not being present in elophant.txt
Member
Posts: 1,160
Joined: Nov 19 2012
Gold: 250.00
Jan 5 2014 07:24pm
I just tried this

@echo off
findstr /c "Justicar Aatrox" elophant.txt
if %errorlevel%==1 (
echo Justicar Aatrox >> skinsNotOwned.txt
) else (
echo Justicar Aatrox >> skinsOwned.txt
)

which returned the same results. Clearly the problem is in the way I search. I think it is searching for any part of the string. So if I had another string with Aatrox in it or Justicar in it, it would return true.
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Jan 6 2014 12:31am
Code
@echo off
findstr "Justicar Aatrox" elophant.txt
if %errorlevel%==0 (echo Justicar Aatrox >> skinsOwned.txt) else (echo Justicar Aatrox >> skinsNotOwned.txt)
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll