1

I need to trigger an event, say open music player with a particular music file, when I press a Key (other than the dedicated play/pause button).

How can I do that with taskscheduler (Schtasks.exe) ?

I am using Windows 8.1

  • AFAIK no, but you could make a task, and then make a shortcut to that task, and set a keyboard shortcut for that shortcut. More info here. Or use AutoHotKey – ᔕᖺᘎᕊ Jul 19 '14 at 17:11
4

AFAIK, there is no way to do this, but there is a workaround:

  1. Create the Task in Task Scheduler. Make the name short, non-spaced (to make it easy)
  2. Check the 'run with highest privileges box'
  3. Choose your action
  4. Test it (to make sure it works as expected)
  5. Go to Desktop, right click > New > Shortcut
  6. For the location, use schtasks /run /tn “TASKNAMEINQUOTES”, changing TASKNAMEINQUOTES with the task name (in step 1) (in quotes).
  7. Name the shortcut anything you want > finish
  8. Right click the shortcut, and make a keyboard shortcut in the 'Shortcut' tab, in the 'Shortcut key' field.

(From here, but without screenshots)


Alternatively use AutoHotKey.

Your script will look something like:

#z::Run "C:\Users\USERNAME\Music\iTunes\Example.mp3" (or if you've made a bat file, #z::Run "C:\Users\USERNAME\Documents\Example.bat")

#z:: means on the shortcut Windows+Z

  • Say I write a bat file with <<start "" "music.mp3">> and map the file to <<Action>> of task scheduler. Now I need to run the task when I press a key on keyboard. So I need the Trigger to be a key-stroke. How to do I make a particular key strok as a trigger? – MAKZ Jul 19 '14 at 17:26
  • @MAKZ The last step says how to do this. – ᔕᖺᘎᕊ Jul 19 '14 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.