AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1713776
Accepted
David Balažic
David Balažic
Asked: 2022-03-31 22:44:34 +0800 CST2022-03-31 22:44:34 +0800 CST 2022-03-31 22:44:34 +0800 CST

如何使数字键盘键始终在 Windows 中输入数字?

  • 772

如何在 Windows 中获得与此 linux 功能等效的功能:

setxkbmap -option numpad:mac

从文档:

numpad:mac 数字键盘键始终输入数字(如在 Mac OS 中)

这意味着无论是否按下 NumLock 键和 NumLock LED 状态如何,键盘始终输入数字,而不是光标移动。

我为 Windows 找到的最接近的东西是关闭 NumLock 键(使用应用程序或直接使用注册表项键盘布局/“扫描码映射”),但这只是给出了我从未按下 NumLock 键的状态。数字键盘模式仍然可以通过软件更改,在启动时从 BIOS 继承等。

作为“奖励”,我还想关闭 LED。

所以:LED 熄灭,按键输入数字,总是

windows keyboard
  • 2 2 个回答
  • 580 Views

2 个回答

  • Voted
  1. Best Answer
    Keith Miller
    2022-04-25T02:15:04+08:002022-04-25T02:15:04+08:00

    我想要类似的行为,并用于HKLM\...\Keyboard Layout\ScanCodeMap将顶行数字键的扫描码映射到数字键盘键,因为顶行键不受NumLock. 该重映射包含在此.reg文件中:

    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,0c,00,00,00,02,00,4f,00,03,00,\
      50,00,04,00,51,00,05,00,4b,00,06,00,4c,00,07,00,4d,00,08,00,47,00,09,00,48,\
      00,0a,00,49,00,0b,00,52,00,34,00,53,00,00,00,00,00
    
    
    

    使用这个重新映射,状态NumLock没有区别,也没有区别,CapsLock但是如果您按住Shift键,您将获得与顶行键关联的符号。

    如果您关闭NumLockvia InitialKeyboardIndicators,您可以包括将扫描码映射Null到NumLock密钥:

    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,0d,00,00,00,02,00,4f,00,03,00,\
      50,00,04,00,51,00,05,00,4b,00,06,00,4c,00,07,00,4d,00,08,00,47,00,09,00,48,\
      00,0a,00,49,00,0b,00,52,00,34,00,53,00,00,e0,45,e0,00,00,00,00
    
    
    

    这应该可以NumLock防止按下按键时指示灯亮起 。(这里没有指示灯,所以无法测试)。它可能仍然可以通过软件打开,但这应该涵盖“正常”情况。

    合并上述任一.reg文件后,注销/登录或重新启动以使更改生效


    在旁边:

    这些ScanCodeMap值是由这个PowerShell脚本创建的。它允许(相对)轻松地编辑扫描码数组,以根据需要添加和删除重新映射。因为它正在编辑HKLM配置单元,所以您必须拥有Admin权限并从Admin PowerShell控制台运行 scfipt。

    ##############################################################
    $SimplePairs = @(
     0x02, 0x4f # 1 ! > 1 end
     0x03, 0x50 # 2 @ > 2 ↓
     0x04, 0x51 # 3 # > 3 pg dn
     0x05, 0x4b # 4 $ > 4 ←
     0x06, 0x4c # 5 % > 5
     0x07, 0x4d # 6 ^ > 6 →
     0x08, 0x47 # 7 & > 7 home 
     0x09, 0x48 # 8 * > 8 ↑
     0x0a, 0x49 # 9 ( > 9 pg up
     0x0b, 0x52 # 0 ) > 0 Ins
     0x34, 0x53 # . > > . Del
    # 0x00, 0x3a # Null > CapsLock
    )
    $ExtendedPairs = @(
     0x00, 0xe0, 0x45, 0xe0 # Null > NumLock(0xe045)
    )
    $ByteCount = 2 * $SimplePairs.Length + $ExtendedPairs.Length + 16
    $Remap = New-Object -TypeName byte[] -ArgumentList $ByteCount
    $Remap.Length
    $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
    
    
    • 3
  2. harrymc
    2022-04-25T07:26:15+08:002022-04-25T07:26:15+08:00

    认识一下 NumLock Enforcer,它是由一位名为“lanux128”的捐赠编码员编写的。

    这是一个AutoHotkey脚本,它将强制您的 NumLock 始终处于打开状态,无论某些程序是否已将其设置为关闭。它通过每 500 毫秒检查一次状态来完成此操作。

    这是脚本(注意分号开始注释):

    ; NumLock Enforcer
    ; To monitor and switch on the NumLock key
    ; Date: 01/07/2007  ;Last Updated: 01/07/2007
    ; Refer: hxxp://www.donationcoder.com/Forums/bb/index.php?topic=9018
    ; Changes since:
    ; ***** 
    ;
    #SingleInstance force
    ;#NoTrayIcon  ;if you don't need a tray icon
    #InstallKeybdHook
    #Persistent
    
    ;Menu, tray, Icon, %A_WinDir%\System32\shell32.dll, 105
    appname=NumLock Enforcer
    SetTimer, EnforceNumLock, 500
    Return
    
    EnforceNumLock:
       NumLockStatus := GetKeyState("Numlock", "T")
        IfEqual, NumLockStatus, 0
          {
          SetNumLockState, On
          ;Uncomment the below line if you want some kind of feedback.
          ;TrayTip,%appname%,NumLock Status = On,,1
          }
    Return
    
    ;Win+p pauses the script,just in case you need the NumLock.
    #p::Pause
    
    ;Win+q exits...
    #q::ExitApp
    

    安装 AutoHotKey 后,将上面的文字放在一个名为的文件中 NumLock Enforcer.ahk,然后双击它进行测试。您可以通过右键单击托盘栏中的绿色 H 图标并选择退出来停止脚本。要让它在登录时运行,请将其放在位于 的 Startup 组中
    C:\Users\USER-NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup。

    • 0

相关问题

  • 如何在 Windows Precision 触摸板上禁用鼠标加速?

  • 批量重命名图像文件集

  • Python 的“pass”参数的批处理等价物是什么?

  • 在 Windows 上与 Docker 守护进程通信

  • 资源管理器侧面板中的桌面外壳快捷方式

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    v15 为什么通过电缆(同轴电缆)的千兆位/秒 Internet 连接不能像光纤一样提供对称速度? 2020-01-25 08:53:31 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve