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:

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+.

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

  • 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,.

  • 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?

  • 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

  • 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.

  • 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.

  • 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.

  • 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.

  • 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!

  • 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?

  • 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)

  • 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

  • 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).

  • 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

  • Fantastic! works like a charm 😀

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

  • 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!

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

  • unfortunately google doesn-t help me…

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

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

  • Hi,
    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!

  • 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?

  • 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!

  • 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?

  • 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.

  • 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.

  • 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!

  • 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.


  • 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

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

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

Leave a reply:

Your email address will not be published.


Sliding Sidebar