This week someone asked me how they could set their keyboard’s “media key” to open Spotify instead of the default Media Player. Information about this around the web is fragmented and decades old, so I decided to share what I’ve learned here.

Media and app shortcuts are found on many types of keyboards either as dedicated buttons or (often on laptops) as key combinations you can activate together with an FN toggle key, which provide easy access to play and pause media or open specific apps like your browser or calculator.

Some examples of keyboards with media and app shortcut buttons.

If your keyboard came with customization software, you should probably close this webpage and use that instead — it’s always a better idea to use the officially supported methods to alter the functionality of your devices. If, however, your keyboard or laptop provides no way to alter the functionality of your media or app shortcut keys, read on to find out how to adjust it directly in the Windows registry.

Registry Location

The settings for the media and application buttons are stored in the registry under the Explorer key. To change the settings computer-wide so it affects all users of the computer (which you’ll need administrator access to the computer to do), you can go to the following registry key. (Registry “folders” are called keys).

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey

To make the change only for your own user account and not impact any other users of the computer, you can go to following registry key instead. Note that the “AppKey” sub-key of Explorer may not exist here by default, but you can create it by right-clicking the Explorer key and choosing New > Key.

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey

Once inside the AppKey key of the registry, look for or create another registry key (“folder”) inside it with a name that matches the key number in the table at the end of this post. It’s inside here you’ll create registry values.

For example, my Calculator button

For examples below we’ll look at re-associating my Calculator key on my Sculpt Ergonomic Desktop Keyboard, which is AppKey 18. I’ve already created an 18 key, which you can see here. When not otherwise defined, the key follows the default action (opening Calculator in this case).

We’ll add entries into this “18” key to modify what the Calculator button does.

Example One: Associate a button to a file type

One way to modify what the key does is by specifying file type extension as a new string value. From then on, the key will open whatever program is currently associated to the given file type. For example, if I add an association of “.txt”, my calculator button will launch Notepad because Notepad is the default handler for txt files.

A string value named Association allows you to specify a file type (including the dot) for which the default handler will open when the media key is pressed.

Example Two: Associate a button to a command or program name

Another option is to specify a shell command that is executed when the button is pressed. This command can be anything that you can type into your terminal or Run box, including a specific program file name or other command.

I’ve seen at least one user specify the command rundll32.exe user32.dll, LockWorkStation which will lock the workstation (although Windows-L is fine enough for me).

Creating a string value of ShellExecute allows you to specify an exact program name or command to run.

The list of AppKey numbers are below for your reference. It should go without saying that as a undocumented registry change, this functionality could change and stop working at any point, as Microsoft has no obligation to use these specific registry keys in this manner. That being said, these media keyboards have been around for nearly 30 years now and are used by literally billions of people using countless different customization software to do so, so it’s safe to say it’ll stick around for a while in this case.

Key NumberDefault Action
1Go Back
2Go Forward
3Refresh
4Stop loading
5Search
6Favorites
7Homepage
8Mute volume
15Mail
16Media
17My Computer / This PC
18Calculator
24Mute microphone
25Lower mic volume
26Raise mic volume
27Help
28Find
29New
30Open
31Close
32Save
33Print
34Undo
35Redo
36Copy
37Cut
38Paste
39Reply
40Forward (mail)
41Send
42Spell checker
43Toggle dictation
44Toggle microphone
45Corrections

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.