Hello,
I am trying to run an IF statement against a string match from a file. from the file. i am looking to find a match on this:
State : FailedSeverity : Error
I firstly load a variable like this
$stringmatch = Get-Content "c:\test.txt"
my if statement looks like this but gives me an error
if(Select-String "State : Failed`nSeverity : Error" $stringmatch)
{
}
I thought if i used the `n this would designate a new line in my string, the error i get when i run it is
Select-String : Cannot bind argument to parameter 'Path' because it is an empty string.+ if(Select-String "State : Failed`nSeverity : Error" $stringmatch)
+ ~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Select-String], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.SelectStringCommand
the $stringmatch variable does contain strings I have checked.
thanks
Steve