Skip to content
⌘ NSIS Forum Archive

Help with StrCmp

5 posts

Guest#

Help with StrCmp

Hi, I am Java programmer and new to NSIS I need help with StrCmp. I want to achieve the following:

($var1 != "") == ($var2 != "")

I did not see the way to use Java && (and) operator with StrCmp, is there a way to do the same in NSIS, and how would I compare two variables as shown above.

Thanks
RobGrant#
StrCmp $var1 "" varOneEmpty neitherVarEmpty

varOneEmpty:
StrCmp $var2 "" varTwoEmpty neitherVarEmpty

varTwoEmpty:
; Do stuff which can only be done if both are empty
Goto post

neitherVarEmpty:
; oops, at least one of them wasn't empty

post:
; stuff to do for either case

-rob-
Afrow UK#
There's also LogicLib which is great for those hardcore programmers like myself 🙂

See Examples\LogicLib.nsi

-Stu