I have a text 'File.txt'. There are 100's of lines.
The file contains the string 'XX' (in any line), 'YY' (in any line) and 'ZZ' (in any line).
I want to check if the text file really contains 'XX' or 'YY' or 'ZZ'. If it yes then exit the script.
I'm not sure how to give multiple search patterns in the below line Or any modification to this existing code would help.
$myString = Select-String -Path C:\Temp\File.txt -Pattern "XX"
Edited Code:
$myFile = Get-Content -Path 'C:\file.txt | Out-String
if (Select-String $myFile -Pattern 'XX|YY' -NotMatch)
{
Do something else
}