title: How to get the current CPU usage and available memory in batch file?
body: <p>I am creating a simple script that outputs the current user logged in, CPU usage for the current system and the available memory?</p>
  
  <p>I have managed to get the current user/s logged on but is it possible to get the cpu usage and memory as well?</p>
  
  <p>This is my code so far.</p>
  
  <pre><code>@echo off
  
  for /f "tokens=3 delims=\" %%i in ("%USERPROFILE%") do (set USER=%%i) 2&gt;&amp;1  
  echo "Logged On User: %USER%"  
  echo. 
  
  pause
  </code></pre>
  
  <p>To get the cpu usage i have tried this command but it doesn't seem to be working.</p>
  
  <pre><code>for /f "skip=1" %p in ('wmic cpu get loadpercentage') do 
  echo %p%
  </code></pre>