Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Windows Batch File to pair with IFTTT and mute your phone while running an application
@echo off
echo Do Not Disturb Mode for Gaming/Application
echo ------------------------------------------
echo Invoking WebRequest to IFTTT for Launch Recipe
powershell -Command "& {Invoke-WebRequest{event_name}/with/key/{super_secret_key} >$null}"
echo Success
echo Launching Application... (Please do not close this Command Prompt Window)
Start /wait "" "C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\game\bin\win64\dota2.exe"
echo Invoking WebRequest to IFTTT for Close Recipe
powershell -Command "& {Invoke-WebRequest{event_name}/with/key/{super_secret_key} >$null}"
echo Success
echo Closing...
timeout /t 5

This comment has been minimized.

Copy link
Owner Author

commented Mar 22, 2016

In case anyone ever needs this and is new to Batch and PowerShell like I am. Thanks to Robbie Page for the idea of how to do this.

Step 1: Login to your IFTTT account and create a new recipe
Step 2: For the trigger choose the Maker Channel and the 'Receive a web request' trigger
Step 3: Name the event (e.g. "dota_launch")
Step 4: For the action choose the 'Android Device' (in my case) channel and the 'Mute Ringtone' action, then create the action
Step 5: Uncheck the 'Receive notifications' box if you don't want to be alerted each time the event is triggered.

Step 6: Create another recipe, this time for the closing of the application. For example the event name in my case is "dota_close" and the action restores my ringtone volume to 100%.

Step 7: While still logged in, go to to obtain your key.
Step 8: Open the 'do_not_disturb_mode.bat' in text editor like Notepad.
Step 9: On Line 6, replace {event_name} with the name of the launch event you created, and {super_secret_key} with the key obtained in Step 7 (remove the curly braces around event_name and super_secret_key).
Step 10. Same thing on line 11, except the event_name is the closing event.
Step 11: Finally, replace the file path on line 9 with the file path to the application you want to run in do not disturb mode. Save.
Step 12: Now, when wanting to launch the application / video game (e.g. Dota 2), open do_not_disturb_mode.bat (may have to run as administrator), instead of opening the application through the direct shortcut. When the application is closed, your phone will return to full volume (or whatever you set the close event to do).


This comment has been minimized.

Copy link

commented Dec 12, 2018

thanks this was helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.