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
Memory usage percentage to txt file
Moderator: DosItHelp
Re: Memory usage percentage to txt file
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
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