您现在的位置是:网站首页> 编程资料编程资料
使用PowerShell获取当前主机内存使用量和总量的方法_PowerShell_
2023-05-26
376人已围观
简介 使用PowerShell获取当前主机内存使用量和总量的方法_PowerShell_
群里一个小兄弟的提问
用PowerShell来写比c#要简单太多了,WMI直接提供了方法,调用即可。
#made by kukisama $a=(get-wmiobject -class Win32_PhysicalMemory -namespace "root\cimv2").Capacity $b=(get-wmiobject -class Win32_PerfFormattedData_PerfOS_Memory -namespace "root\cimv2").AvailableMBytes $c=$a/1024/1024 $d=$c-$b cls echo 您当前总内存$c 可用内存$b 已用内存$d

本文出自 “九叔-微软私有云” 博客
您可能感兴趣的文章:
相关内容
- PowerShell String对象方法小结_PowerShell_
- PowerShell 数组的多种录入方法_PowerShell_
- PowerShell脚本反引号用法实例:随时随地给代码换行_PowerShell_
- Powershell目录文件夹管理权限的继承和指定方法_PowerShell_
- PowerShell启用winrm失败:拒绝访问 0x80070005 -2147024891_PowerShell_
- PowerShell隐藏不显示窗口的多种方法_PowerShell_
- Powershell脚本的4种执行权限介绍_PowerShell_
- PowerShell中的转义字符是什么?_PowerShell_
- PowerShell批量文件重命名操作实例_PowerShell_
- PowerShell中以管理员权限启动应用程序的方法_PowerShell_
