PowerShell 技能连载 - 集合操作方法
基础集合操作
1 | # 创建强类型集合 |
应用场景
- 数据过滤:
1 | Get-Process | Where-Object {$_.CPU -gt 100 -and $_.Name -notmatch '^svchost$'} |
- 批量重命名:
1 | $files = Get-ChildItem *.log |
最佳实践
- 使用泛型集合提升性能
1 | $queue = [System.Collections.Queue]::new() |
- 利用管道优化内存使用
1 | # 流式处理大文件 |
- 嵌套集合处理
1 | $serverData = @( |
PowerShell 技能连载 - 集合操作方法
https://blog.vichamp.com/2025/03/13/powershell-collection-operations/
