Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch logical operators

Status
Not open for further replies.

mbrink

Technical User
Jul 5, 2002
13
US
I'm trying to write a batch program to make a daily checklist of proceedures based on what day it is. But I can't find anything for operators like AND or OR to use in IF statements for Win2K command prompt. If need be, I could use nested IFs for AND, and separate IFs for OR, but some of the situations are so complicated that it would be a mess to write, and even worse to try to read afterwards if something needs to be changed.

Does such a feature exist for Win2K commend prompt? ANd if so, how?
 
Hello mbrink,

You have conditional processing symbols avail:
and ==> &&, &
or ==> ||

Check out the comand shell overview

How compound them is up to your imagination. For instance,
if dir filename.txt > nul && %fname%=="" set fname=filename.txt
will set the environment fname to filename.txt if filename.txt exists here (the 2nd command will not evaluate if the first successful for &&)

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top