AllExperts > Windows NT 
Search      
Windows NT
Volunteer
Answers to thousands of questions
 Home · More Windows NT Questions · Answer Library  · Encyclopedia ·
More Windows NT Answers
Question Library

Ask a question about Windows NT
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Chris Schuh
Expertise
I have several years of schooling in this area (including post-secondary), and also several years in the work force. This is my career, and I love helping others out with computer problems. I possess excellent written communication skills which allows me to guide people through complicated solutions to their problems with relative ease. Outside of helping people with their computer issues, I'm also a Professional Magician and a Musician. You can check me out at www.chrisschuh.com!

 
   

You are here:  Experts > Computing/Technology > Focus on Windows 2000/NT > Windows NT > Windows NT Batch File

Windows NT - Windows NT Batch File


Expert: Chris Schuh - 1/17/2006

Question
Hi 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

Answer
Hi 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

View Follow-Ups    Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.