Windows NT/Windows NT Batch File
Expert: Chris Schuh - 1/17/2006
QuestionHi Chris,
Below is a short example of my batch file:
set blah=823182
type %temp%\patches.txt | find "%blah%"
if errorlevel 1 echo "%blah% missing"
set blah=826232
type %temp%\patches.txt | find "%blah%"
if errorlevel 1 echo "%blah% missing"
set blah=828035
type %temp%\patches.txt | find "%blah%"
if errorlevel 1 echo "%blah% missing"
set blah=828749
type %temp%\patches.txt | find "%blah%"
if errorlevel 1 echo "%blah% missing"
What I want to do is make this a little more elegant by using a loop though my list of 823182, 826232, 828035, 828749 such as
set blah = 823182 826232 828035 828749
and then using a for loop and pipe (|) for my find but I can't get it to work so I have no choice but to do this clumsy list of instructions which works fine but is not pretty. Basically patches.txt is a text list and if I don't find an entry in this list I print out "missing" it's just a simple little program.
Thanks!
Marc
AnswerHi Marc,
To be honest, I'm not sure if that's possible within DOS. Yes, a loop would be more elegant, but I didn't see much about loop programming in DOS that would apply to this situation. Did you have any starting points or references that you were already pursuing?
Cheers,
Chris