Last active
June 18, 2024 20:52
-
-
Save oldendick/b584d2891b2a2880ff6b5966aa48ccba to your computer and use it in GitHub Desktop.
Remap caps lock to ctrl in windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using this method is preferred over powertoys because it will also work with | |
# remote desktop and vmware. | |
# | |
# https://superuser.com/questions/949385/map-capslock-to-control-in-windows-10 | |
# | |
# Setting an execution policy might be necessary to run powershell scripts. | |
# see: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.4 | |
# Set-ExecutionPolicy -ExecutionPolicy <PolicyName> -Scope <scope> | |
# For example: | |
# Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process | |
# | |
# save as caps-remap.ps1 | |
# run as administrator from a powershell window: | |
# .\caps-remap.ps1 | |
$hexified = "00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00".Split(',') | % { "0x$_"}; | |
$kbLayout = 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout'; | |
New-ItemProperty -Path $kbLayout -Name "Scancode Map" -PropertyType Binary -Value ([byte[]]$hexified); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment