Created
October 20, 2017 09:03
-
-
Save shaneis/0f742b09b6655342a03925999ceb05de to your computer and use it in GitHub Desktop.
Using if and match to check a string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fileNames | ForEach-Object -Process { | |
if ($_ -match 'Index') { | |
"Use index on: $_" | |
} elseif ($_ -match 'Stats') { | |
"Use stats on: $_" | |
} elseif ($_ -match 'Backups') { | |
"Use backup on: $_" | |
} elseif ($_ -match 'Restores') { | |
"Use restores on: $_" | |
} elseif ($_ -match 'Checkdbs') { | |
"Use checkdbs on: $_" | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment