title: How to close all active windows/applications using a batch file
body: <p>I am a beginner.I just went curious about cmd so I want to make a batch file that kills the active windows and shutdown/restart the computer safely.
  I came across commands like-</p>
  
  <p>taskkill /im "program.exe"</p>
  
  <p>tasklist</p>
  
  <p>shutdown -s</p>
  
  <p>But I want to close all active windows but not forcefully.
  If there a specific command  or some combination of commands please do mention.
  Thanks in Advance.</p>
  
  <p>PS-  I came across powershell but I want to know if i can achieve this using batch file (cmd commands) .Below is the link</p>
  
  <p><a href="https://stackoverflow.com/questions/9725629/how-to-close-all-windows">How to close all windows</a> </p>