I accidently did this command in powershell windows 10 and my mouse buttons are swapped.
rundll32.exe user32.dll,SwapMouseButton
How to fix it?
I was testing this command like in a youtube shorts. But I don't know how to fix it.
I accidently did this command in powershell windows 10 and my mouse buttons are swapped.
rundll32.exe user32.dll,SwapMouseButton
How to fix it?
I was testing this command like in a youtube shorts. But I don't know how to fix it.
SwapMouseButton
is a native Windows API function that can be called from PowerShell using P/Invoke.
Add the P/Invoke definition using Add-Type
and then call the API function, passing $false
to revert to normal mouse button behavior:
# Add the P/Invoke API definition
$api = Add-Type -PassThru -Namespace Win32 -Name Win32SwapMouseButton -MemberDefinition @'
[DllImport("user32.dll")]
public static extern bool SwapMouseButton(bool fSwap);
'@
# Call the API to restore normal mouse button behavior
$api::SwapMouseButton($false)
Likewise, you can pass $true
to swap mouse buttons again, without having to resort to the rundll32 hack.