How would you implement logical operators in DOS Batch files?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do
andwith nested conditions:You can also do this in a short form:
You can do
orwith a separate variable:Note that this answer is tailored toward
cmdbatch language, the one found in Windows. You mention "DOS batch" but, based on several points, I think the former choice is a safe bet(1).If you really meant the original MS-DOS batch language, you should keep in mind that the
ifstatement was a lot simpler, and you may need to use chunks ofif ... gotofor control flow, rather than (for example) parentheses orelse.(1) Supported by the following points:
cmdandwindows-consoletags;cmdand MS-DOS batch languages, and conflating DOC with thecmdterminal window;