我正在寻找总数commit charge。
答案 0 :(得分:4)
public static long GetCommitCharge()
{
var p = new System.Diagnostics.PerformanceCounter("Memory", "Committed Bytes");
return p.RawValue;
}
答案 1 :(得分:1)
以下是使用WMI的示例:
strComputer = "."
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer)
Set colSWbemObjectSet = _
objSWbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")
For Each objSWbemObject In colSWbemObjectSet
Wscript.Echo "Total Physical Memory (kb): " & _
objSWbemObject.TotalPhysicalMemory
WScript.Echo "Total Virtual Memory (kb): " & _
objSWbemObject.TotalVirtualMemory
WScript.Echo "Total Page File Space (kb): " & _
objSWbemObject.TotalPageFileSpace
Next
如果在CScript下运行此脚本,您应该会看到命令窗口中显示的目标计算机上安装的物理内存的千字节数。以下是脚本的典型输出: 总物理内存(kb):261676
修改:包含的总页面文件大小属性
取自:http://www.microsoft.com/technet/scriptcenter/guide/sas_wmi_dieu.mspx?mfr=true