VBS修改:
strComputer = "localhost"
Set wbemServices = GetObject("winmgmts:\\" & strComputer)
Set wbemObjectSet = wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")
For Each wbemObject In wbemObjectSet
WScript.Echo wbemObject.TotalPhysicalMemory
Next
去掉了:"Total Physical Memory (kb): " &
BAT:
for /f %%i in ('"cscript //nologo 1.vbs"') do if %%i LSS 800000 执行命令
如果命令多:
for /f %%i in ('"cscript //nologo 1.vbs"') do if %%i GEQ 800000 exit
执行命令
纯VBS:
strComputer = "localhost"
Set wbemServices = GetObject("winmgmts:\\" & strComputer)
Set wbemObjectSet = wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")
Set WSHShell = WScript.CreateObject("WScript.Shell")
For Each wbemObject In wbemObjectSet
if wbemObject.TotalPhysicalMemory < 800000 then WshShell.Run "执行命令"
Next
Last edited by zh159 on 2007-2-19 at 07:42 PM ]