找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 18446|回复: 2

[系统相关] 如何使用批处理一键关闭粘滞键

[复制链接]
发表于 2022-1-23 22:11:41 | 显示全部楼层 |阅读模式
本帖最后由 Oo神罚oO 于 2022-1-24 15:12 编辑

问:批处理》如何使用批处理命令一键关闭“控制面板---》轻松使用-----》键盘----》里面粘滞键功能(按5次shift弹出)
 楼主| 发表于 2022-1-24 15:12:42 | 显示全部楼层
有知道的大佬吗
发表于 2022-1-24 23:29:22 | 显示全部楼层
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)
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-20 17:07 , Processed in 0.028182 second(s), 9 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表