由于有残疾,我喜欢每隔半小时左右就能从使用右手鼠标切换到使用左手鼠标,然后再切换回来。从控制面板执行此操作比我希望的要慢。虽然我可以在命令行或.bat文件中使用main.cpl打开鼠标设置控制器,但我希望能够使用批处理文件完成整个左右切换。这是可能的吗?如果可能,是如何实现的?
发布于 2019-09-16 10:36:02
您可以将代码复制到PS1文件中,并使用Powershell运行它:
[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
[bool]$returnValue = $SwapButtons::SwapMouseButton(!([System.Windows.Forms.SystemInformation]::MouseButtonsSwapped))https://stackoverflow.com/questions/57949592
复制相似问题