Is it possible to schedule "Alarms Only" mode in Windows 10 using a shell script?
If you're a Windows 10 user, you may have noticed the "Alarms Only" mode, which allows you to silence all notifications except for alarms. This mode can be quite useful when you want to focus on important tasks or have a peaceful night's sleep without being disturbed by unnecessary notifications. But have you ever wondered if it's possible to schedule this mode using a shell script?
Unfortunately, Windows 10 does not provide a built-in feature to schedule the "Alarms Only" mode. However, there is a workaround that involves using a shell script and a third-party tool called NirCmd. NirCmd is a command-line utility that allows you to perform various tasks in Windows, including manipulating system settings.
Step 1: Download and Install NirCmd
To begin, you'll need to download and install NirCmd. Follow these steps:
- Visit the NirCmd website at https://www.nirsoft.net/utils/nircmd.html.
- Scroll down to the "Download NirCmd" section and click on the download link for the appropriate version of Windows (32-bit or 64-bit).
- Save the downloaded file to a location on your computer.
- Extract the contents of the downloaded ZIP file to a folder of your choice.
- Remember the path to the NirCmd executable file, as you'll need it in the next steps.
Step 2: Create a Shell Script
Now that you have NirCmd installed, you can create a shell script to schedule the "Alarms Only" mode. Follow these steps:
- Open a text editor, such as Notepad, on your Windows 10 computer.
- Copy and paste the following code into the text editor:
@echo off
set nircmd="C:\path\to
ircmd.exe"
%nircmd% cmdwait 1000 monitor off
%nircmd% cmdwait 1000 mutesysvolume 1
%nircmd% cmdwait 1000 setdefaultsounddevice "Headphones"
%nircmd% cmdwait 1000 setsysvolume 0
%nircmd% cmdwait 1000 monitor on
- Replace "C:\path\to ircmd.exe" in the code with the actual path to the NirCmd executable file that you saved earlier.
- Save the file with a .bat extension, such as "alarms_only.bat".
Step 3: Schedule the Shell Script
Now that you have the shell script ready, you can schedule it to run at specific times using the Windows Task Scheduler. Follow these steps:
- Press the Windows key + R to open the Run dialog box.
- Type "taskschd.msc" (without quotes) and press Enter to open the Task Scheduler.
- In the Task Scheduler window, click on "Create Basic Task" in the Actions pane.
- Follow the on-screen instructions to set a name and trigger for the task. For example, you can choose to run the task daily at a specific time.
- In the "Action" step, select "Start a program" and browse to the location where you saved the shell script file.
- Complete the remaining steps and click "Finish" to schedule the task.
That's it! You have successfully scheduled the "Alarms Only" mode using a shell script and the Windows Task Scheduler. Now, at the specified time, the shell script will run and activate the "Alarms Only" mode, silencing all notifications except for alarms.
Conclusion
While Windows 10 does not provide a direct way to schedule the "Alarms Only" mode, you can achieve this functionality using a shell script and the NirCmd utility. By following the steps outlined in this article, you can schedule the "Alarms Only" mode to automatically activate at specific times, allowing you to have uninterrupted focus or a peaceful night's sleep.
| Source | Link |
|---|---|
| NirCmd | https://www.nirsoft.net/utils/nircmd.html |