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

PowerTip: Use PowerShell to See if String Has Wildcard Character

$
0
0

Summary: Use Windows PowerShell to determine if a string contains a wildcard character.

Hey, Scripting Guy! Question How can I use Windows PowerShell to determine if a string contains a wildcard character?

Hey, Scripting Guy! Answer Use the static ContainsWildcardCharacters method from the System.Management.Automation.WildcardPattern
           .NET Framework class, for example:

PS C:\> $wc = '*'

PS C:\> $wc

*

PS C:\> [System.Management.Automation.WildcardPattern]::ContainsWildcardCharacters($wc)

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>