Powershell 展示进度条
2021/4/28 7:26:50
本文主要是介绍Powershell 展示进度条,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Powershell 展示数据处理进度, 并已进度条展示
$userlist = @() $users = gc D:\Script\ImportFiles\accountslist.txt $i = 0 foreach($user in $users) { $i++ $w = $i.ToString() + '/' + $users.Count.ToString() $percent = "{0:0.0%}" -f ($i/$users.Count) Write-Progress -Activity "Preparation 进度显示" -Status "请耐心等待,$w , $percent" -PercentComplete ($i/($users.count) * 100) try { Get-Mailbox $mail -WarningAction SilentlyContinue -ErrorAction Stop |Out-Null $obj = New-Object psobject $obj |Add-Member -MemberType NoteProperty -Name EmailFound -Value 'True' -Force $userlist += $obj } catch { $obj01 = New-Object psobject $obj01 |Add-Member -MemberType NoteProperty -Name EmailFound -Value 'False' -Force $userlist += $obj01 } } $userlist |ogv
结果展示
这篇关于Powershell 展示进度条的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2022-09-14SharePoint 2019 用 PowerShell将启用发布功能站点网站集另存为模板
- 2022-08-30PowerShell教程 - 程序性能和BUG分析工具
- 2022-08-30PowerShell教程 - 模块管理(Modules Management)
- 2022-08-29PowerShell教程 - Web requests(Web请求)
- 2022-08-26PowerShell教程 - 日期时间管理(Date & Time Management)
- 2022-08-25PowerShell教程 - 磁盘与硬件管理(Disk & Hardware Management)
- 2022-08-25PowerShell教程 - 系统事件管理(System Event Management)
- 2022-08-25PowerShell教程 - 文件系统管理(File System Management)
- 2022-08-24PowerShell教程 - 网络管理(Network Management)
- 2022-08-24PowerShell