我找不到任何有关 PowerShell 语法的引用 -like
运营商。
comparison operators 上的 Windows PowerShell 引用仅声明:
-Like
Description: Match using the wildcard character (*).
虽然通过实验我发现它也支持
?
和 []
(设置)。是否支持任何其他语法?是否有明确的引用
-like
运营商?
最佳答案
about_Comparison_Operators的帮助确实声称支持通配符。它没有具体说明通配符是什么。
-Like Description: Match using the wildcard character (*).
进一步深入了解帮助 about_Wildcards我们了解到这些不是你爷爷的通配符:
Windows PowerShell supports the following wildcard characters. Wildcard Description Example Match No match -------- ------------------ -------- ----------------- -------- * Matches zero or a* A, ag, Apple banana more characters ? Matches exactly ?n an, in, on ran one character in the specified position [ ] Matches a range [a-l]ook book, cook, look took of characters [ ] Matches specified [bc]ook book, cook hook characters
about_Comparision_Operators 帮助中的另见部分中提到了通配符帮助的链接。
关于powershell - 类似 PowerShell 的运算符支持哪些模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26778044/