Windows 10 または 11 でマウスホイールの回転の向きを逆向きに設定する方法を記しておく。
以下の内容を mouse_wheel_setting.ps1 として保存。文字コードは BOM 付きの UTF-8 とする。
# 管理者チェック
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "管理者権限で実行してください。"
exit
}
Write-Host "接続中のマウスを検索中..." -ForegroundColor Cyan
# HID デバイスの中からマウスだけを抽出
$devices = Get-PnpDevice -Class Mouse | Where-Object { $_.InstanceId -like "HID*" }
if ($devices.Count -eq 0) {
Write-Host "マウスが見つかりませんでした。" -ForegroundColor Red
exit
}
# 一覧表示
for ($i = 0; $i -lt $devices.Count; $i++) {
Write-Host "[$i] $($devices[$i].FriendlyName) ($($devices[$i].InstanceId))"
}
# 選択
$index = Read-Host "操作したいマウスの番号を入力してください"
if ($index -notmatch '^\d+$' -or $index -ge $devices.Count) {
Write-Host "不正な番号です。" -ForegroundColor Red
exit
}
$target = $devices[$index]
$instanceId = $target.InstanceId
Write-Host "`n選択されたデバイス: $($target.FriendlyName)"
Write-Host "Instance ID: $instanceId`n"
# レジストリパス
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Enum\$instanceId\Device Parameters"
if (-not (Test-Path $regPath)) {
Write-Host "レジストリパスが見つかりません: $regPath" -ForegroundColor Red
exit
}
# 現在値の取得
$current = (Get-ItemProperty -Path $regPath -Name "FlipFlopWheel" -ErrorAction SilentlyContinue).FlipFlopWheel
if ($null -eq $current) { $current = 0 }
Write-Host "現在の FlipFlopWheel 値: $current"
# トグル処理
$newValue = if ($current -eq 0) { 1 } else { 0 }
Write-Host "新しい値: $newValue に変更します..."
Set-ItemProperty -Path $regPath -Name "FlipFlopWheel" -Value $newValue -Type DWord
Write-Host "レジストリ更新完了。" -ForegroundColor Green
# デバイス再起動(PnP 再スキャン)
Write-Host "デバイスを再起動しています..." -ForegroundColor Cyan
pnputil /scan-devices | Out-Null
Write-Host "完了しました!マウスを抜き差ししなくても反映される可能性があります。反映されていない場合はマウスを抜き差ししてね。" -ForegroundColor Green
管理者 PowerShell にて以下のように実行。
powershell -ExecutionPolicy Bypass -File .\mouse_wheel_setting.ps1
ホイールの回転を逆にしたいマウスを選択するプロンプトが表示されるので、番号で指定。
(必要があれば) マウスを PC から外して再度接続