If you want a button that quickly closes all your chosen running apps, you’re in luck. Windows 11 lets you make such a button, and I’ll show you how.

Why Create a Panic Button

There are many reasons you may want to create a panic button. Maybe you work at a co-working space and people occasionally come up to your desk. Having a panic button ensures they don’t see your open apps. Perhaps you’re asked toshare your screen, and you don’t want your open apps displayed.

Having the ability to quicklyclose all your chosen appsat once also helps you get into focus mode, if that’s what you’re looking for.

Notepad’s “Save As” window to save the panic button batch script.

Close All of Your Programs Using a Batch File

One way to quit all your chosen running apps is by using abatch file. A batch file contains a set of commands that run one after another, achieving the specified tasks.

To create such a file, open Windows Search (press Windows+S), typeNotepad, and launch the app. In a new document, type the following:

Notepad’s “Save As” window to save panic button’s PowerShell script.

In the script, next to each taskkill command, specify the process name of the apps you want to close. To find an app’s process name, right-click the Windows taskbar and choose “Task Manager.” Access the “Details” tab, and you’ll see each app’s process name.

After modifying the script, from Notepad’s menu bar, select File > Save As. Select the folder in which you want to save the file. Click the “Save as Type” drop-down menu and choose “All Files.” Select the “File Name” field and type something likePanicButton.bat. Then, click “Save.”

“Begin the Task” and “OK” highlighted on the “New Trigger” window.

The next time you want to close all your chosen running apps, double-click your batch file. To add your batch file’s shortcut to your desktop (if you haven’t saved the file on your desktop), right-click the file and choose Show More Options > Send To > Desktop (Create Shortcut). To assign it a keyboard shortcut, right-click the shortcut and choose “Properties.” Access the “Shortcut” tab, click “Shortcut Key,” and press the desired key combo. Then, make sure to click “Apply” followed by “OK.”

Using PowerShell

PowerShell is another way on Windows 11 to close all your chosen running apps. To use this method, open Windows Search (press Windows+S), typeNotepad, and open the app. In a new document, type the following:

In the script, replace the app names with the apps you’d like to close. Make sure to use your apps’ process names and not actual names. you’re able to find an app’s process name in the Details tab of Task Manager.

“Program/Script,” “Add Arguments (Optional),” and “OK” highlighted on the “New Action” window.

After creating the script, from Notepad’s menu bar, select File > Save As. Select the folder where you want to save the file. Click the “Save as Type” drop-down menu and choose “All Files.” Click the “File Name” field and type something likePanicButton.ps1. Then, click “Save.”

When you want to close all your chosen open apps, right-click your file and choose “Run With PowerShell.”

Tocreate the file’s shortcut on your desktop, right-click the file and choose Show More Options > Send To > Desktop (Create Shortcut). To assign it a keyboard shortcut, right-click the shortcut and choose “Properties.” Open the “Shortcut” tab, click the “Shortcut Key” field, and press the shortcut you want to use. Then, click “Apply” followed by “OK.”

Using Task Scheduler

If you want to close your chosen open apps automatically at a specific time or when youlock your machine, integrate your batch file or PowerShell script with Task Scheduler.

To start, open Windows Search (press Windows+S), typeTask Scheduler, and launch the utility. On the right pane, click “Create Task.” Select the “Name” field and type a name for your task. Access the “Triggers” tab, click “New,” and choose when you want to close your apps.

For example, to close your apps when you lock your PC, click the “Begin the Task” drop-down menu and choose “On Workstation Lock.” To close the apps at a specific time, click the “Begin the Task” drop-down menu, choose “On a Schedule,” and define the time.

In either case, save your changes by clicking “OK.”

Open the “Actions” tab and click “New.”

If you want to use your batch file, click “Browse” and select your file. If you want to use your PowerShell script, click the “Program/Script” field and typepowershell.exe. Click the “Add Arguments (Optional)” field and type the following (replace the script path with the actual path).

Click “OK” and choose “OK” again to save your task.

And that’s how you can close your chosen running apps with a single click or key press on Windows 11. While you’re at it, consider learningsome Power Automate flowsto automate tasks on your computer.