打开/关闭NumLock指示灯.BAT
20小时前 23

无聊逛 无忧,,看见一帖 ,,
http://wuyou.net/forum.php?mod=viewthread&tid=441644&fromuid=570058
广大笔记本电脑用户的福音,运行后关闭NumLock指示灯,适合作为开机登录脚本。 ,,,,,,,,,,,,复制人家的,,,
他那写法是生成文件的,于是改编一下写法,混编写法,不产生文件写法,,
无忧那很少登录,基本都是白嫖下载,,,,不够等级发帖,,,,,,

-------开启NumLock指示灯...

'&cls&for /f %%a in ('powershell [Console]::NumberLock') do ( Start "" WScript -e:Vbscript %~0 %%a & exit )
If InStr(WScript.Arguments(0), "True") > 0 Then  
Else
CreateObject("wscript.shell").Sendkeys "{NumLock}" 
End If

-------关闭NumLock指示灯...

'&cls&for /f %%a in ('powershell [Console]::NumberLock') do ( Start "" WScript -e:Vbscript %~0 %%a & exit )
If InStr(WScript.Arguments(0), "True") > 0 Then  
CreateObject("wscript.shell").Sendkeys "{NumLock}" 
Else
End If

BAT + VBS  混编写法,,另存为 xxx.bat,,,,


也可以修改成 检测大写键是否开启,,,,,,

'&cls&For /f %%a in ('powershell [Console]::CapsLock') do ( Start "" WScript -e:Vbscript %~0 %%a & exit ) 
If InStr(WScript.Arguments(0), "True") > 0 Then  
    WScript.Echo "大写键开启"
Else
    WScript.Echo "大写键关闭"
End If

 

----------------------------纯BAT 写法 一行过,,,,,
--开启NumLock指示灯,,,

for /f %%a in ('powershell [Console]::NumberLock') do ( Echo.%%a|find "True" || MsHta VBscript:CreateObject^("Wscript.Shell"^).Sendkeys^("{NumLock}"^)^(Window.Close^))

--关闭NumLock指示灯,,,

for /f %%a in ('powershell [Console]::NumberLock') do ( Echo.%%a|find "True" && MsHta VBscript:CreateObject^("Wscript.Shell"^).Sendkeys^("{NumLock}"^)^(Window.Close^))

以上写法 都是 检测 True 返回 也可以写成  检测 False 返回,,,,

奖励
收藏
点赞
分享
没有签名,不想写。
最新回复 (0)
返回