I've called .ps1 function in batch file and assigned the result to $Value
variable:
for /f "delims=" %%a in ('powershell -ExecutionPolicy Bypass .\test.ps1 -TargetGroupArn "arn:aws:elasticloadbalancing:eu-west-1:570226278193:targetgroup/whocms-uat/cc28ab2765d2503c" -TargetId "i-01fab6896b4efa925" -state "healthy" -timeout 240') do Set "$Value=%%a"
When checked with echo it prints the correct result: 09/13/2018 16:34:34 : healthy
Echo Value received from PowerShell : %$Value%
But I am not able to check if the result contains substring:
set str1=%Value%
if not x%str1:healthy=%==x%str1% echo It contains healthy