Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to Check String for a Match

$
0
0

Summary: Learn how to check a string to see if it contains another string.

Hey, Scripting Guy! Question How can I use Windows PowerShell to check a string to see if it contains another string?

Hey, Scripting Guy! Answer Use the –Match operator:

PS C:\> $a = [string]"This string contains a number of letters"

PS C:\> $a -match 'a number'

True


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>