Help with the if command.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Loreuya
Posts: 3
Joined: 20 Aug 2015 12:13

Help with the if command.

#1 Post by Loreuya » 21 Aug 2015 07:06

if %variable%==(condition 1);(condition 2) echo (sentence here)

How can i put two conditions in one line? Does the ; work as space?

I don't wanna do like this:

if %variable%==(condition 1) echo (sentence here)
if %variable%==(condition 2) echo (sentence here)

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Help with the if command.

#2 Post by foxidrive » 21 Aug 2015 07:10

Code: Select all

@echo off
for %%a in ("condition 1" "condition 2") do if /i "%variable%"=="%%~a" echo (sentence here)

Post Reply