How do you do if AND if then statement?

Microsoft Windows
Post Reply
User avatar
MigrationUser
Posts: 336
Joined: 2021-Jul-12, 1:37 pm
Been thanked: 2 times
Contact:

How do you do if AND if then statement?

Post by MigrationUser »

23 Mar 2017 12:51
NDog


This has me stumped

If condition and condition do s/t
otherwise
if not condition or not condition do s/t

Code: Select all

If ComputerName <> "LHSTS" And If ComputerName <> "LHSTS01" Then '~~ Skip Terminal Server machine information ~~
  ' do stuff
End If
Never works the way I want it to

Last edited by NDog (23 Mar 2017 12:55)

cmd, vbs, ps, bash
autoit, python, swift

----------------------------

#2 23 Mar 2017 17:19

Simon Sheppard

You don't need multiple nested IF's... just build an expression with AND, OR, NOT and brackets
things like this are valid:

Code: Select all

If (3 > 2) and (4 > 3 or 2 = 3) Then...
Post Reply