Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check available memory (RAM) via batch script?

I would like to know that how we can check the available memory in batch script? Is there any method already available? If it is not possible in batch script then is there any other way by which we can get the memory available?

OS: Windows XP / Windows 7

like image 681
Anand Avatar asked Nov 27 '22 03:11

Anand


1 Answers

Alternative:

C:\>wmic os get freephysicalmemory
FreePhysicalMemory
4946576

to parse out to a variable (wmic output has a header + extra line on the end)

for /f "skip=1" %%p in ('wmic os get freephysicalmemory') do ( 
  set m=%%p
  goto :done
)
:done
echo free: %m%

free: 4948108

(freevirtualmemory is available also)

like image 100
Alex K. Avatar answered Dec 01 '22 00:12

Alex K.