Thanks for the reply. I can find the variable is a string. In command window I am giving "echo notepad | example.exe ". When $sOutput and $string2 (where I have already declared "notepad") matches it should go inside the if condition. But it is not working. Code: MsgBox($MB_SYSTEMMODAL, "", $sOutput) --> It gives the result "notepad" Global $string2 = "notepad" if $sOutput == $string2 Then MsgBox($MB_SYSTEMMODAL, "", "entered the if condition" & $string2) EndIf