Page 1 of 1
Memory usage percentage to txt file
Posted: 28 Feb 2015 02:13
by mohdfraz
Hello,
I want to get Memory Usage percentage to c:\Memory.txt through batch file.
I am using windows 8 and want the Memory usage percentage identical as showing in Task Manager.
Thanks
Re: Memory usage percentage to txt file
Posted: 28 Feb 2015 05:59
by Compo
I'm not sure if this will exactly match the figure you're looking for, but give it a try:
Code: Select all
@Echo Off
SetLocal EnableExtensions
For /F "Skip=1 Tokens=*" %%A In (
'WMIc OS Get FreePhysicalMemory^,TotalVisibleMemorySize') Do (
For %%B In (%%A) Do If Not Defined _ (Set/A _=100*%%B) Else (Set/A _=_/%%B)
)
Echo(Free Memory = %_%%%>C:\Memory.txt
Re: Memory usage percentage to txt file
Posted: 28 Feb 2015 06:19
by mohdfraz
Compo wrote:I'm not sure if this will exactly match the figure you're looking for, but give it a try:
Code: Select all
@Echo Off
SetLocal EnableExtensions
For /F "Skip=1 Tokens=*" %%A In (
'WMIc OS Get FreePhysicalMemory^,TotalVisibleMemorySize') Do (
For %%B In (%%A) Do If Not Defined _ (Set/A _=100*%%B) Else (Set/A _=_/%%B)
)
Echo(Free Memory = %_%%%>C:\Memory.txt
Compo,
Wahoo,, Very nice,,, Thank you very much.
Its not exactly matching but giving +/- 6% which is also good.
Thanks