如何禁用 Microsoft Natural Ergonomic Keyboard 4000 (v1.0) 上的 F Lock 键?
我不想物理禁用密钥,所以我想要一个软件修复。键盘通过 USB 连接,没有 PS/2 连接器。
@JNK 的回答让我找到了下面的 URL,它描述了如何通过更改 IntelliType Pro 的配置来模拟禁用 F Lock 键。
该页面上的文件特定于旧版本的 IntelliType,因此我担心使用它们,以防我丢失了 IntelliType 的一些其他功能。但是,通过比较那里提供的原始文件和修改后的文件,我能够编写以下 PowerShell 2 脚本,该脚本将对您碰巧安装的任何 IntelliType 版本的 commands.xml 文件进行等效更改。
如果您对 PowerShell 一无所知,那么可能对您毫无用处。如果您确实了解 PowerShell - 享受吧!
#requires -version 2
set-strictmode -version latest
$keyCodes = @(302, 203, 204, 307, 308, 309, 900, 901, 902, 401, 311, 310)
$matchRegex = '^\s*<C({0})\s.*$' -f ($keyCodes -join '|')
# This used to be:
# $filename = "$env:ProgramFiles\Microsoft IntelliType Pro\commands.xml"
$fileName = "$env:ProgramFiles\Microsoft Mouse and Keyboard Center\commands.xml"
$backupFileName = $fileName -replace "\.xml$", ".original.xml"
if (-not (test-path $backupFileName)) {
write-verbose "Backing up commands.xml"
cp $fileName $backupFileName
}
$file = (get-content $fileName) -replace $matchRegex, ""
$xml = [xml]$file
$allAppsStd = $xml.DPGCmd.ALL.Application |
?{ $_.UniqueName -eq "StandardSupport" }
$nextFKey = 1
$keyCodes | %{
$elemName = "C{0}" -f $_
$fkey = "F{0}" -f $nextFKey
$nextFKey++
$new = $xml.CreateElement($elemName)
$new.SetAttribute("Type", "5")
$new.SetAttribute("KeySeq", $fkey)
$allAppsStd.AppendChild($new) | out-null
}
$xml.Save($fileName)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7471 次 |
| 最近记录: |