How To Remap Keyboard Keys In Windows (Such as the with Apple Keyboard)

//How To Remap Keyboard Keys In Windows (Such as the with Apple Keyboard)

How To Remap Keyboard Keys In Windows (Such as the with Apple Keyboard)

I use the Apple bluetooth wireless keyboard, but I use it with my Windows computer, not a Mac. I love it though, and I think it’s the best bluetooth keyboard around – the problem is, while most keys generally work fine, certain keys are missing.


For instance, on the Apple keyboard, the command key is the Windows key by default, so that’s convenient. However, I don’t have the Home and End keys, which make text-editing cumbersome. Furthermore, I have no Delete key. That sucks, because you can’t even delete a file in Explorer with the keyboard this way. In addition, the keyboard has the left Alt key and the left Windows key completely opposite from my notebook (a Lenovo Thinkpad T410s).

So I went about looking for a solution, and found it in the form of AutoHotKey. It’s a free, open-source utility for Windows that enables you to create scripts for automating keystrokes and mouse clicks. What’s important though, is that it allows you to remap keys as well.

I chose this solution over SharpKeys (another key re-mapping utility) primarily because AutoHotKey allows for “profiles”, which is useful because sometimes I use my notebook alone without my external keyboard, and I want the default key mappings to be restored. With AutoHotKey, I just run a script that remaps the keys that I want, and whenever I’m outside with just my notebook, I disable the script and I’m back to my default key settings.

I had to use a script that was generously given to the community, and modify it to suit my needs. If you’re interested, here it is: AutoHotKey script for Apple Keyboard.


  1. You’ll first need to install AutoHotKey.
  2. Then, download my zip archive (AutoHotKey script for Apple Keyboard), and extract it to wherever you want.
  3. Now, just run the file “Keyboard Media Keys.ahk”.
  4. All set!


What this script does is to remap the eject key on the keyboard to be a Delete key. I’ve also modified some of the Apple keyboard keys to suit me though, and you can change it in the file “Keyboard Media Keys.ahk”. Look for them from line 46-49, and they’ll look like this:


So what that means is that I’ve swapped the positions of the left Alt key and the left Windows key. I’ve also set the right Alt key to be End and the right Windows key to be Home.

Hope you find this useful and let me know if you need further help with it!

Similar Posts:

By |2010-07-02T17:03:28+00:00July 2nd, 2010|Tutorials & Tips|36 Comments

About the Author:

Alvin Poh lives in Singapore, and is interested in marketing, techy stuff, and likes to just figure out how the two can work with each other. He can also be found on Google+.


  1. Anon July 18, 2010 at 6:25 pm - Reply

    Hi, Can't seem to get remap of Mac Eject to Windows Backspace and Mac Delete to Windows Delete to work with the native keyboard of teh Macbook Pro 17' latest model. any thoughts? Thanks,.

  2. Alvin Poh July 18, 2010 at 7:42 pm - Reply

    Mine's an external keyboard but it's strange because theoretically the key codes should be the same (I don't have a MBP to test though). Are you trying with AutoHotKey?

  3. Anon July 19, 2010 at 7:15 pm - Reply

    Yes, used AutoHotKey and the following your instructions above for installation and scripts. one would think it would be the same.
    Seems to work for serttings: Keyboard Media Keys.ahk
    But not for: Keyboard Media Keys Actions.ahk
    Perhaps it is checking the wrong code
    Trying to Remap Apple's Eject ==> Windows Delete and Apple's Delete ==> Windows Backspace.
    thanks for your help

  4. Alvin Poh July 19, 2010 at 7:48 pm - Reply

    Ahh…check the instructions.txt file in the package. You probably need to run “Keyboard Media Keys – detect keys.ahk” for your keyboard. See if it says that the Eject key gives you a value of 4854. If it doesn't, you'll need to edit Keyboard Media Keys Actions.ahk with the right value number.

  5. Anon July 19, 2010 at 8:53 pm - Reply

    eject seems to be a special key. i cannot get it to pop a code. also this seems to indicate it's special as well.

  6. Alvin Poh July 19, 2010 at 9:12 pm - Reply

    Yes it's a special key, and the original author of the guide put in the DLL just to detect keys like that. I'm not sure why it doesn't appear for MBP keyboards though, and I apologise that I can't test it because I don't have a MBP. However, if it's helpful, I'm using it with the external Apple keyboard, and that works well.

  7. Anon July 19, 2010 at 11:07 pm - Reply

    OK Thanks for all your help and will find another solution. or deal with it… When i run AutoHotkeyRemoteControlDLL.ahk and it lists a bunch of HID, MICE and Keyboards (2 e.g. when i have 1). and when i click on either in the list, i get an error and it crashes. Perhaps the DLL is old and not Win 7 compatible. anyway. thansk so much for your kind attention. And for letting me know it works for you. I will try with a wireless apple keyboard.

  8. Alvin Poh July 20, 2010 at 1:15 am - Reply

    No problem! 🙂 Actually I'm using Win 7 64bit too, so it's strange – the only thing I can think of is that the MBP keyboard is somehow giving different values, or that the autohotkey program cannot interface it through the Mac…*shrug* Well, hope you find out why…these things can be annoying sometimes!

  9. JoseROrtiz July 29, 2010 at 8:55 pm - Reply

    Awesome script! This is exactly what I needed! I'm encountering an issue when trying to move through the Alt+Tab menu though. The Alt+Tab menu comes up, but once I tab to the application I want to bring up, the Alt+Tab pop-up stays there. Have you had this issue?

  10. Alvin Poh July 30, 2010 at 6:29 am - Reply

    Yep same here. Unfortunately it turns out to be a specific Alt-Tab behaviour in Windows that doesn't seem to have a solution from what I've searched (it doesn't affect other hot-key combinations). So what I do is Alt-Tab, Enter (to choose the app), and Alt once (to toggle Alt off, because it somehow stays on)

  11. Brendon August 19, 2010 at 9:46 pm - Reply

    Hi Alvin, I'm trying to capitalise on your great info here. I've downloaded the current AutoHotKey installer plus your zip archive and extracted it, but when I try to open the file “Keyboard Media Keys.ahk” I get these pop-up messages; “The program can't star because MFC71.DLL is missing from your computer.” followed by “RegisterDevice failed. Errorcode: -3”.
    I'm running Win 7 on Bootcamp not that that probably makes any difference. Could you tell me what I'm doing wrong please? Thanks, Brendon

  12. Alvin Poh August 20, 2010 at 2:38 am - Reply

    MFC71.DLL's part of windows, so it looks like it can't be found. I suggest googling for that, and downloading the dll from a reputable download site (because of the inherent risks of installing a dubious DLL).

  13. Kage December 7, 2010 at 1:56 am - Reply

    THANKS!! My windows keyboard finally crapped out on me so I dusted up my bluetooth kb one more time and this helped me out a shit ton!!
    Win 7 64 Bit
    Works perfectly

  14. Josh January 22, 2011 at 8:47 am - Reply

    Fantastic! works like a charm 😀

  15. Jon January 27, 2011 at 5:31 am - Reply

    Hey thanks loads for this brilliant just what I was after thanks loads for sharing this !!! brilliance and great logic still exists.. !!

  16. andrea May 5, 2011 at 7:14 am - Reply

    hi man, I-m trying to use these scripts on my win 7 x32 for the apple wireless keyboard, but when I launch keboard media keys.ahk, the program give me and error message, “error, a goto cannot jump…” and display me the lines 53 to 69. Please help me!

    • Alvin May 5, 2011 at 7:19 am - Reply

      Sorry, I haven’t come across that error before. Try googling for the exact error message and see what pops up?

    • Joao May 23, 2018 at 8:55 am - Reply

      same here. did you get it solved?

  17. andrea May 5, 2011 at 7:23 am - Reply

    unfortunately google doesn-t help me…

  18. valensen June 15, 2011 at 9:18 am - Reply

    Have the same problem as andrea. Error message pops up.

  19. Garrick June 23, 2011 at 3:00 pm - Reply

    I’m having the same “goto” error as Andrea and valensen.

  20. lb June 28, 2011 at 8:47 pm - Reply

    I had the same “error goto” problem but it seems to be fixed now. The script worked on my Vista laptop but didn’t on my other Windows 7 tablet. After, looking around I saw that the two didn’t use the same version of AutoHotKey (Vista had and Windows 7 had I installed (download from AHK website) in a separate folder (i.e. both versions are now installed) on my tablet and now the script works perfectly. Anyway, that worked for me. Good luck!

  21. Mats Svensson July 6, 2011 at 7:12 am - Reply

    Seems like another dead end =(

    This does not work unless you get an older version of autohotkey,

    and then it doesn’t work because MFC71.DLL is missing,

    and then that can only be downloaded from virussites,

    and then…. blah blah blah…

    Does anyone know of a solution that just works, without the need of any five year research project?

  22. lb July 6, 2011 at 1:35 pm - Reply

    Hi Mats,

    Sorry that the workaround didn’t work for you, it did work for me on two different computers (although for the second one I did have to download two dll files; but that took a total of 5 minutes, not 5 years!). If you are not ready to go for an older version of AHK and to download two different dll files (and there are very safe sites for that) then maybe you should write about your problem on the AHK forum. Good luck!

  23. Mats Svensson July 7, 2011 at 4:03 pm - Reply

    As i said, i tried the older AHK, thats the one that apparently needs the dll file from Microsoft, that you of course cant just download from Microsoft.

    And, yes you can easily find a bazilion places to download the file from by googling it.
    All very very very eager to supply files for you to stick in your computer indeed…

    So problem solved in 5 minutes, not really nope.

    If you have a actual safe place to get it from, why not share the info?

  24. lb July 8, 2011 at 5:12 pm - Reply

    Hi Mats,

    Yes you have to be careful where you download your dll files from. If the dll files are from Microsoft, I usually use their store or go to If they are not from Microsoft, then I try to download them from a company that offers it as support for their product. In the current case, you can download the necessary dll files from or from the reputable support service of at the following address: Just download and open the zip file (it contains four dll files, including the two that were necessary for me to get the keyboard to work.) Hope this helps.

  25. Ingemar July 21, 2011 at 7:49 am - Reply

    Hi everyone / Ib

    I’ve had quite some troubles running the scrips using Windows 7 Ultimate and Autohotkey. I firstly ran into the same problems as mentioned above with the error message “Goto: Cannot jump….”, so I tried downloading all available versions of Autohotkey from their homepage. I found the “Basic” one to work on my pc. Then I ran into the problem of the missing DLL. I did as what was suggested and downloaded the pack from audible but found no such folder on my pc to copy it into. I then did some more google research and found out you must copy the missing DLL to Windows/systems32 folder which I did. Then register it in the registry using regsvr32. Now I got a error message saying the MFC71.dll is not compatible with the version of windows I have.

    So now I am back to where I started, and have no idea of what to persue next. Even considered trying a Snowleopard installation on my Intel Desktop Board DH67CF but after going through support pages for Hacintosh it seems nearly like a full time job getting a IOS to work on a PC with a motherboard which has not been tried out before.

    Any suggestions would be greatly appreciated. And btw, Ib – I think you do a awesome job of trying to help everyone. Thanks alot for all the effort.

  26. lb July 21, 2011 at 6:42 pm - Reply

    Hi Ingemar,

    Sorry this is not yet working for you. There’s got to be a way!

    Here are four suggestions that you could try. Before you try them, you should maybe read the rather lengthy (and boring!) explanations I wrote after the four suggestions so that you have a better idea of what I am suggesting.

    1) Put the two dll files that you downloaded from Audible (for me it was mfc71.dll and msvcr71.dll) in the folder that contains the version of AHK that I suggested (i.e. Then run the script. This should work (i.e. no error message and an AHK icon appears in the system tray). If that doesn’t work, try 2).
    2) If 1) doesn’t work, put the dll files in the following folder instead: C\:Windows\SysWOW64. That works if you have Windows 7 64 bits. (If you have a 32 bit system, the folder should be System32 like you mentioned, but I haven’t tried that). Then run the AHK script. No need to use regsvr32, just run the script. If that doesn’t work, try 3).
    3) Leave the two dll filed in SysWOW64 and reboot your system. Then run the script.
    4) If 3) doesn’t work, I would try using the dll files from Just download both files (links below), and retry steps 1-3.

    GOOD LUCK! And now some explanations:

    – I am now using this AHK keyboard script on three different computers and it works flawlessly.
    – All three are using Windows 7 Home Premium edition 64 bits.
    – The fact that they are 64 bits is important to know where to put the dll files.
    – As I mentioned in a previous post, the script worked right away on my first computer (running AHK but for the two others I had to download AHK from the AHK website. Both of these computers came with AHK 1.0.97.x and the script didn’t work with that version of AHK (I got the “error goto” problem that others have mentioned). I don’t know if you absolutely need 1.0.48, I just know that for me it works with 1.0.48 and doesn’t with 1.0.97.
    – For the two computers for which I had to install AHK, when I initially ran the script, I didn’t get the “error goto” problem anymore but I got a message saying that mfc71.dll file was missing. Once I installed it, running the script gave a message that msvcr71.dll was missing. After I installed that second dll file, the script worked beautifully.
    – For one of the computers, I got the dll files from as stated in a previous post (see: and also For the other computer, I got the dll files from the Audible site as mentioned in the previous post (see: Both of these sets of dll files have worked for me, whether they come from or from Audible.
    – For me, it was sufficient to put the two dll files in the folder where AHK 1.0.48 is installed for the script to work. That means: I put the files in the AHK folder, then ran the script and no error message appeared: instead, an AHK icon appeared in the system tray.
    – Now here is the special part if you don’t expect it: the two dll files have now disappeared from my AHK folder. This is to be expected. The two dll files have now been transferred automatically in the following folder: C\:Windows\SysWOW64. In your post you mention System32 but if you have a 64 bits system, it seems that this folder has become SysWOW64. System32 (and now SysWOW64) are folders that are used by Windows as dll repositories: when you run a new application that uses a new dll file, Windows stores a copy (in this case, for me it didn’t copy but actually transferred the files) of this dll file in this folder so that it can be used by other programs.
    – If I remove either of the two dll files from SysWOW64, then the “missing dll files” message reappears when I run the AHK script. If I put the files back, the script runs perfectly.
    – In both cases, I didn’t have to run anything like regsvr32.

    Hope this is helpful!

  27. Kevin September 14, 2011 at 9:51 am - Reply

    Hi, thank you for this tutorial and script files!
    I too had to install the ‘Basic” version of AutoHotKeys because I kept getting a “GoTo… outside a function” error.

    Luckily, we have the same keyboard so I didn’t have to use “detect – keys”. I could just run “Keyboard Media Keys” straight away, WITHOUT installing the driver!
    So it works completely now, the Win and ALT keys are changed, and the Eject is now delete 😀

    But is there a way to change the functions keys? Like fn+F8 (the play/pause button) to something like Control+Alt+Shift+P which I have mapped to iTunes Play, using iTunesControl?

    And also change system screen brightness using fn+F1 or F2?
    Maybe even open Control Panel when fn+F4 is pressed.


  28. S0N1C February 22, 2012 at 3:15 pm - Reply

    Thanks for sharing these scripts, tryed them with older version of AHP but it kept crashing, so I did a little modifications in Keyboard Media Keys.ahk so now it works with AutoHotkey110602_Install

  29. Justus June 1, 2012 at 9:25 am - Reply

    x64 Windows 7, Apple Wireless Keyboard. Works perfectly! Thanks so much!

  30. Benny T. June 18, 2012 at 12:00 am - Reply

    very useful. i wouldnt even begin to know what keys are what to remap the keyboard. it all seems to be done via scripting.

  31. Hal October 17, 2018 at 12:26 pm - Reply

    Thanks for the idea of using AHK, I was struggling with a way to map my DEL key so I can use my apple wireless bluetooth keyboard with my Lenovo laptop. However… the link to the zip files seems to be broken ( is the script still available?

    • Alvin Poh November 1, 2018 at 5:31 am - Reply

      Thanks for letting me know, I’ve fixed the URL. Give it a shot again

  32. Matt October 28, 2018 at 7:33 pm - Reply

    HI Alvin, this seems super useful; I’d love to finally get my Apple keyboard fully functional!

    Unfortunately the download link for the .ahk file (text: “AutoHotKey script for Apple Keyboard”, URL: “”) doesn’t seem to work anymore. Could you please fix this when you get a chance?

    • Alvin Poh November 1, 2018 at 5:31 am - Reply

      Thanks for letting me know, I’ve fixed the URL. Give it a shot again

Leave A Comment