Board logo

标题: [系统相关] 如何使用批处理一键关闭粘滞键 [打印本页]

作者: Oo神罚oO    时间: 2022-1-23 22:11     标题: 如何使用批处理一键关闭粘滞键

本帖最后由 Oo神罚oO 于 2022-1-24 15:12 编辑

问:批处理》如何使用批处理命令一键关闭“控制面板---》轻松使用-----》键盘----》里面粘滞键功能(按5次shift弹出)
作者: Oo神罚oO    时间: 2022-1-24 15:12

有知道的大佬吗
作者: went    时间: 2022-1-24 23:29

1打开,0关闭
保存test.bat,文件ansi编码
  1. #&cls&@powershell -c "Get-Content '%~0' | Out-String | Invoke-Expression" &pause&exit
  2. $code=@'
  3.     using System;
  4.     using System.Runtime.InteropServices;
  5.     public struct STICKYKEYS{
  6.         public int cbSize;
  7.         public int dwFlags;
  8.     }
  9.     public static class WinApi{
  10.         [DllImport("user32.dll")]
  11.         public static extern bool SystemParametersInfo(int act, int param, ref STICKYKEYS sk, int ini);
  12.     }
  13. '@
  14. Add-Type -TypeDefinition $code
  15. #shift5次快捷键 0关闭 1打开
  16. $b_shift = 0
  17. $sk = New-Object 'STICKYKEYS' -Property @{ 'cbSize'=8 }
  18. [WinApi]::SystemParametersInfo(58,8,[ref]$sk,0)
  19. $sk.dwFlags = $sk.dwFlags -band -5 -bor ($b_shift * 4)
  20. [WinApi]::SystemParametersInfo(59,8,[ref]$sk,3)
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2