On the weblogic server there are 2 nodes, sometimes the memory on the server ends and you have to reboot the nodes, wrote bat.file that checks the status of the nodes and if the memory exceeds the allowable rate, it reboots the node
@Echo Off SET procName=notepad++.exe SET RAMLimit=20 Set "sum=0" For /F "Tokens=6-7 Delims=., " %%a In ( 'TaskList /NH /FI "ImageName Eq %procName%"') Do Set/A sum+=%%a%%b echo %sum% echo %procName% echo %RAMLimit% if %RAMLimit% GEQ %sum% taskkill /im notepad++.exe* /f >7.txt Pause This script works for the experiment. I took the notepad, but when it completes the task of the notepad, it finishes itself and I need this bat to work all the time.