windows – 如何使用PowerShell计算和使用单个进程的多个实例的
发布时间:2020-12-14 04:16:15 所属栏目:Windows 来源:网络整理
导读:在power shell命令下运行时,我有以下结果, PS C: Get-Process svchostHandles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName------- ------ ----- ----- ----- ------ -- ----------- 546 34 18528 14884 136 49.76 260 svchost 357 14 4856 4396 47 18.
在power
shell命令下运行时,我有以下结果,
PS C:&; Get-Process svchost Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 546 34 18528 14884 136 49.76 260 svchost 357 14 4856 4396 47 18.05 600 svchost 314 17 6088 5388 42 12.62 676 svchost 329 17 10044 8780 50 12.98 764 svchost 1515 49 36104 38980 454 232.04 812 svchost 301 33 9736 6428 54 2.90 832 svchost 328 26 8844 9744 52 4.32 856 svchost 247 18 8144 9912 77 37.50 904 svchost 46 5 1504 968 14 0.02 1512 svchost 278 15 4048 5660 43 3.88 2148 svchost 98 14 2536 2460 35 0.66 2504 svchost 在这里我试图计算进程的总内存大小PM(K).我在ps1脚本文件中有以下行 get-process svchost | foreach {$mem=("{0:N2}MB " -f ($_.pm/1mb))} 它以下列格式给出输出 17.58MB 4.79MB 6.05MB 9.99MB 35.29MB 9.56MB 8.64MB 7.95MB 1.47MB 3.95MB 2.48MB 但我需要总大小作为单个值,如107.75MB 如何计算svchost进程的总使用内存大小? 谢谢
您可以使用Measure-Object cmdlet
$measure = Get-Process svchost | Measure-Object PM -Sum $mem = ("{0:N2}MB " -f ($measure.sum / 1mb)) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows – Windbg!heap -s和!heap -stat命令不同意输出
- windows-phone-7 – windows phone芒果 – 点击和点击之间的
- 有时 – 无法构建Windows Azure云服务 – 对象引用未设置为
- 在Windows中捕获笔记本电脑盖关闭事件?
- windows-server-2008-r2 – 来自非域客户端的域服务器的RDP
- entity-framework – 是否可以将Entity Framework与Windows
- WPF RibbonWindow Windows 8 – 控制框看起来很糟糕
- Windows Server 2016-Nano Server介绍
- Windows – 从命令提示符更改快捷方式的目标
- Windows C:如何重定向stderr以调用fprintf?