I am trying to execute a sript to run exe file, get the output, search through the output and then if its true do soemthing:
$output = cmd /c file.exe additionalvariables --batch |
write-host |
where-object($_ -eq "Finished with Success") #finished with success does not work
if ( -eq "Finished with Success") # I need to perform a check
{
"Command executed"
$tcp.Dispose()
Exit 0
}
else
{
"There is an issue with file.exe additionalvariables command"
EXIT 1
$tcp.Dispose()
}
So the finished with success does not work in line 1, do you know how to check if statement? if ( -eq "Finished with Success")
.