1

Hello guys I'm facing a problem that two of my keyboard key is not working i.e.(LShift and RShift) so I want to replace one of them with other key i.e.(RCtrl).While I was trying to re-map these keys through windows registry(run-regedit-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout\Scancodes Map)but the problem is that I don't know the actual scan codes for my laptop keyboard layout.My laptop product name is "HP 15 Notebook PC".I also use some third party softwares for re-mapping my keys and check out Microsoft Key Scan Codes list but none of these were useful for me.So can someone please help me out to resolve this issue by providing me right scan codes for my keyboard or any type of correct link?

6
  • 1
    Not sure if that's possible, but you can install a third-party and virtually remap your right Ctrl key to act as a Shift key. I use Clavier+ (utilfr42.free.fr/util/Clavier.php?sLang=en) to do all sorts of keyboard shortcuts and stuff, you could give it a try.
    – user1019780
    Commented Apr 13, 2020 at 14:11
  • Keyboard Test Utility can tell you what scancodes are associated with any key. I use it to determine values & a PowerShell script I authored to create the binary ScanCode Map value. Commented Apr 13, 2020 at 16:54
  • @Didier bruh thanks for the suggestion but I want to re-map my keys and for that I require scan codes but not to create/update shortcuts of the computer's programs and this software you recommends me is also for creating/updating shortcuts.
    – ITian
    Commented Apr 13, 2020 at 18:10
  • @KeithMiller Can you please elaborate more that how you can create binary code on PowerShell because I don't know how to use it? I installed Keyboard Test Utility software and it can generate scan code for RCtrl key but not for RShift because its not working as I told later.So can you please help me with this..
    – ITian
    Commented Apr 13, 2020 at 18:20
  • So you get no response from the utility when you press your <Shift> keys? Heve you verified that there is currently no SanCode Map value in the registry that (perhaps inadvertently) is remapping your <Shift> keys to <Null>. Commented Apr 13, 2020 at 19:19

1 Answer 1

1

Here's a PowerShell script I wrote that allows for edits to the remap pairs --- adding or removing --- and creates a ScanCode Map byte array from those pairs.

In your case:

  • LShift = 0x2a
  • LCtrl = 0x1d
  • RShift = 0x36:EXtended
  • RCtrl = 0x1d:Extended

Note that "#" specifies a comment in PowerShell, so those lines are not executed.

As changes need to be made to HKLM, you mustcopy & paste the following code in an Administrative PowerShell console.:

##############################################################
$SimplePairs = @(

 # 0x2a, 0x1d # LShift > LCtrl

)

$ExtendedPairs = @(

 0x2a, 0x00, 0x1d, 0xe0 # LShift > RCtrl

)
$ByteCount = 2 * $SimplePairs.Length + $ExtendedPairs.Length + 16
$Remap = New-Object -TypeName byte[] -ArgumentList $ByteCount
$Remap[8] = $SimplePairs.Length/2 + $ExtendedPairs.Length/4 + 1
For ($i = 0 ; $i -lt $SimplePairs.Length ; $i += 2) {
   $Remap[$i * 2 + 12] = $SimplePairs[$i]
   $Remap[$i * 2 + 14] = $SimplePairs[$i + 1]
}
For ($i = 0 ; $i -lt $ExtendedPairs.Length ; $i += 4) {
   $Offset = $SimplePairs.Length * 2
   $Remap[$i + 12 + $Offset] = $ExtendedPairs[$i]
   $Remap[$i + 13 + $Offset] = $ExtendedPairs[$i + 1]
   $Remap[$i + 14 + $Offset] = $ExtendedPairs[$i + 2]
   $Remap[$i + 15 + $Offset] = $ExtendedPairs[$i + 3]
}
$Splat = @{
Path  = 'HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout'
Name  = 'ScanCode Map'
Value = $Remap
Force = $True
}
# $Splat['Value'] | format-hex
New-ItemProperty @Splat
4
  • Keith can you please tell me what this script is actually doing?Extremely sorry for getting your too much time but I want to make things clear before I am going to apply it.Once again I am telling you that I only want to map/replace LShift key to/with RCtrl key thats it.
    – ITian
    Commented Apr 13, 2020 at 23:33
  • OK, I'll modify the single remap. This was doing both., Commented Apr 13, 2020 at 23:45
  • Yes that's why I again explain it to you and keith please also explain me that script and what I do further now?
    – ITian
    Commented Apr 14, 2020 at 10:11
  • Copy & paste the code into and Administrative PowerShell window. It will create a ScanCode Map value that will remap the right Ctrl key to send a Left Shift. If you want me to explain more, you have to ask specific questions. Commented Apr 14, 2020 at 16:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .