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!

IF.. and statemenet in DOS script

Status
Not open for further replies.

ssphoenix

IS-IT--Management
Jan 22, 2001
306
US
There isn't a dos script forum but perhaps someone could point me to where I could find what I need.

Is there anyway I could get If [statement]==[today] and [day]=1 GOTO lable

Dos (xp shell) script can't seem to want to execute the and statement.

I would greately appreciated.

Thanks
 
You should be able to nest the 'if' statements like this:

if <today> goto <label>

<label>: if <day> goto <another label>

There's always a better way. The fun is trying to find it!
 
AN EVEN EASIER SOLUTION IS

IF &quot;X&quot; == &quot;X&quot; IF &quot;Y&quot; == &quot;Y&quot; ECHO THIS WORKS

THE FIRST &quot;IF&quot; BEING TRUE, EXECUTES THE SECOND &quot;IF&quot; WHICH
BEING TRUE, EXECUTES THE ECHO COMMAND. YOU SHOULD BE ABLE
TO DO 4 OR 5 OF THESE.

THIS IS AN &quot;AND&quot; SOLUTION. IT WOULD TAKE A FEW STATEMENTS
FOR AN &quot;OR&quot; CONDITION.

IF &quot;X&quot; == &quot;X&quot; GOTO OK
IF &quot;Y&quot; == &quot;Y&quot; GOTO OK
GOTO NO
:OK

:NO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top