Skip to content

Instantly share code, notes, and snippets.

@cgorshing
Created April 21, 2024 22:18
Show Gist options
  • Save cgorshing/f89406ff2cc4ffd68d5138ac80e80d0a to your computer and use it in GitHub Desktop.
Save cgorshing/f89406ff2cc4ffd68d5138ac80e80d0a to your computer and use it in GitHub Desktop.
Mouse Wheel Inverse/Reverse Scroll in Windows (all or specific mice)
# Choose which ever way you want. Sometimes I want to do all mice connected.
# Othertimes, I only want to do a specific one
# I've taken these scripts from a couple places and tailored to fit me
# https://github.com/justinlhudson/Config-And-Setup/blob/master/Windows/MouseInvert.ps1
# https://answers.microsoft.com/en-us/windows/forum/all/reverse-mouse-wheel-scroll/657c4537-f346-4b8b-99f8-9e1f52cd94c2
# I have seen where a USB mouse plugged in doesn't have all the values specified under
# Device Parameters. I've had to add it manually in order
Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device Parameters" FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
# Specific single mouse or list of mice
# Plug in your mice
# Start this script, unplug the ones you want to flip to 1
# Then press any key to continue.
# Plug back in and ready to go - you can restart to be safe. But not always needed to restart.
$a = Get-PnpDevice -Class Mouse -PresentOnly -Status OK;
Read-Host "Unplug your mouse, then press any key...";
$b = Get-PnpDevice -Class Mouse -PresentOnly -Status OK;
$a2 = $a | ForEach-Object { $_.DeviceID };
$b2 = $b | ForEach-Object { $_.DeviceID };
$a2 | Where-Object {$_ -NotIn $b2} | ForEach-Object { Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Enum\$_\Device Parameters" -Name FlipFlopWheel -Value 1 };
Write-Host "Restart your machine";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment