How do you swap the primary mouse button via commandline in Windows 8 without a reboot?
Swap mouse buttons from command line
We can swap mouse buttons by editing the registry value
SwapMouseButtons
under the registry keyHKEY_CURRENT_USER\Control Panel\Mouse
. To swap mouse buttons we need to set its value to1
.Same thing can be done from command line using the below command.
reg add "HKEY_CURRENT_USER\Control Panel\Mouse" /v SwapMouseButtons /t REG_SZ /d 1
It requires a logoff or reboot to make the changes effective.
Reference Swap mouse buttons from command line:
Alternative Solution
How do I use Rundll32 to swapmousebutton? for a C# solution (requires the .NET Framework Runtime to be installed)
Related videos on Youtube
Jonathan
Knows 25 computer languages. Former global technical director at DreamWorks Animation SKG. Up for hire for web, app, game, & VR dev http://leadersandco.com
Updated on September 18, 2022Comments
-
Jonathan over 1 year
I've tried
RUNDLL32.EXE USER32.DLL,SwapMouseButton
But it doesn't work, even when run as administrator.
My goal is to make a .bat file that I can call via my fancy shmancy new mouse I bought that allows me to call any arbitrary command from a mouse click.
-
Norbert Willhelm almost 9 yearsThis command works perfectly for me. You do not need to run this command as an administrator, because the setting of the mouse layout is saved under HKCU in the registry.
-
-
Jonathan over 9 yearsUnfortunately, by doing this, it requires a reboot. Which doesn't work since I want to be able to call this at will during work.
-
DavidPostill over 9 yearsPlease edit your question to include this new requirement... :/
-
DavidPostill over 9 years@JonathanLeaders alternative solution added