html tool

2021年7月19日星期一

转:powershell ..运算符

 参考: https://docs.microsoft.com/zh-cn/powershell/module/microsoft.powershell.core/about/about_operators?view=powershell-7.1

范围运算符 ..

表示整数数组中的顺序整数(给定上下限)。

PowerShell
1..10
foreach ($a in 1..$max) {Write-Host $a}

您还可以按相反的顺序创建范围。

PowerShell
10..1
5..-5 | ForEach-Object {Write-Output $_}

没有评论:

发表评论