[b]if(1 -lt 2) { echo "true"} else {echo "false"}[/b]true
2、for循环语句
[b]for($i=1;$i -le 5;$i++){echo $i}[/b]1
2
3
4
5
3、while循环语句
[b]$i=1;for(;$i -le 5;){echo $i;$i++;}[/b]1
2
3
4
5
4、foreach循环语句
[b]foreach($item in 1..5){echo $item}[/b]1
2
3
4
5
参考资料
[1].Powershell IF-ELSE 条件:https://www.pstips.net/powershell-if-else-condition.html
[2].Powershell For 循环:https://www.pstips.net/powershell-for-loop.html
[3].Powershell Foreach 循环:https://www.pstips.net/powershell-foreach-loop.html
[4].从管道中删除对象:https://docs.microsoft.com/zh-cn/powershell/scripting/samples/removing-objects-from-the-pipeline--where-object-?view=powershell-7
评论(0)
暂无评论。