DBeaver下载安装与信创数据库配置全指南
2026/7/9 20:20:04
在PowerShell中,可以使用Add-Member命令为对象添加新属性。例如,为进程对象添加LifeTimeCpu属性:
Get-Process| where-object {$_.product -match “Office”}| add-member -PassThru -memberType scriptproperty -name LifeTimeCpu -value { ($This.cpu/((get-date)-$This.StartTime ).totalSeconds)} | sort-object -Property lifetimeCpu | format-table -autosize -Property name,vm,cpu,@{Label=”Lifetime CPU”; expression={$_.lifetimecpu.toString(“P”)}}执行上述代码后,输出结果如下:
| Name | VM | CPU | Lifetime CPU |
| ---- | ---- | ---- | ---- |
| communicator | 390860800 | 2364.7411585 | 0.27 % |
| WINWORD | 407875584