randyrants / sharpkeys

SharpKeys is a utility that manages a Registry key that allows Windows to remap one key to any other key.
http://www.randyrants.com/
Microsoft Public License
6.11k stars 408 forks source link

Is there a way to automatically import a sharpkeys file? #542

Open asherjacobson opened 1 year ago

asherjacobson commented 1 year ago

I am trying to automate the setting up of new computers which I have to do frequently. Assuming I have a sharpkeys file locally, how could I get the app to read from that file or "import" it from a UI perspective? I am ok with powershell, or other means. I figured maybe there is a filepath I can move the file to in which the application would know to read from it, upon restart/log out and back in. Thank you

randyrants commented 1 year ago

I would direct you to use the Registry Editor itself. I mean, I may have coded "open SharpKeys with this SKL file preloaded" but I don't remember. I likely didn't because the Registry does a better job of it and you'd have to reboot anyway, making the "preloaded SKL" file misrepresent itself as "this is what is currently remapped."

Since SharpKeys is simply a very custom Registry Editor of sorts, what I've historically done is:

The Key is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout The Value is "Scancode Map" - when you export the key above some other stuff comes with it: you can remove from the REG file since Scancode Map is the part you want to merge in.

The REG for turning off Caps Lock is this:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,00,00,3a,00,00,00,00,00