Close all Open Applications (Excel , Notepad) in one line Powershell

If you have many files open in their individual windows, instead of clicking on close repeatedly, you can use one line of Powershell to kill the application process at once:

# Close all Excel windows
 Stop-Process -Name Excel

 # Or for notepad

 Stop-Process -Name Notepad


But to be safe to close all windows, you should use the following:

# Close all Excel windows
 Get-Process Excel -ea 0 | ForEach-Object { $_.CloseMainWindow() }

 # Or for notepad

 Get-Process Notepad -ea 0 | ForEach-Object { $_.CloseMainWindow() }


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s