I tried this PowerShell on a Windows PC; I don't have a Windows setup on my BootCamp to test your exact scenario.
It swapped my buttons for the mouse only. It left the touchpad and pointing stick right-handed.
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
$SwapButtons = Add-Type -MemberDefinition @'
[DllImport("user32.dll")]
public static extern bool SwapMouseButton(bool swap);
'@ -Name "NativeMethods" -Namespace "PInvoke" -PassThru
Write-Host "Mouse buttons currently swapped?" ([System.Windows.Forms.SystemInformation]::MouseButtonsSwapped)
[bool]$returnValue = $SwapButtons::SwapMouseButton(!([System.Windows.Forms.SystemInformation]::MouseButtonsSwapped))
Write-Host "Mouse buttons currently swapped?" ([System.Windows.Forms.SystemInformation]::MouseButtonsSwapped)
As blsub6 mentioned, you can change a registry value (with a command called from a batch file):
REG ADD "HKCU\Control Panel\Mouse" /t REG_SZ /v SwapMouseButtons /d 1 /f
or
REG ADD "HKCU\Control Panel\Mouse" /t REG_SZ /v SwapMouseButtons /d 0 /f
However, you need to logout before it will take effect.
The better solution is to make a tiny .exe with C# to swap the setting, as described in the answers to this question.
Make a text file which you can call swapmouse.cs
, containing this:
using System.Runtime.InteropServices;
using System;
class SwapMouse
{
[DllImport("user32.dll")]
public static extern Int32 SwapMouseButton(Int32 bSwap);
static void Main(string[] args)
{
int rightButtonIsAlreadyPrimary = SwapMouseButton(1);
if (rightButtonIsAlreadyPrimary != 0)
{
SwapMouseButton(0); // Make the left mousebutton primary
}
}
}
And compile it to swapmouse.exe
with this command:
"%SystemRoot%\Microsoft.NET\Framework64\v3.5\csc" swapmouse.cs
In more recent versions of .NET you may need to add /out:swapmouse.exe
and /target:exe
:
"[%SystemRoot%]\Microsoft.NET\Framework64\[version]\csc" /out:swapmouse.exe /target:exe swapmouse.cs
Then you just double-click that exe to swap the mouse buttons. It takes effect immediately.
Or, as rad mentions, you can create a shortcut, and define a keyboard shortcut/hotkey in the Shortcut tab of it's Properties.
Best Answer
You can use X-Mouse Button Control to swap the mouse buttons.
X-Mouse Button Control does its changes by intercepting clicks, so they carry downstream to any Remote Desktop session. But I don't think it has per-mouse settings.