本帖最后由 pcl_test 于 2019-10-27 11:02 编辑
- /*&cls
- @echo off
- set "netpath=%systemroot%\Microsoft.NET\Framework"
- for /f "delims=" %%a in ('dir /ad /b "%netpath%\v?.*"') do (
- if exist "%netpath%\%%a\csc.exe" (
- set "cscpath=%netpath%\%%a\csc.exe"
- goto :end
- )
- )
- echo;未安装.Net Framework 2.0及其上版本组件或相关程序丢失&pause&exit
- :end
- if not exist "%tmp%\$CheckKeyLocked.exe" (
- "%cscpath%" /out:"%tmp%\$CheckKeyLocked.exe" "%~f0"
- )
- "%tmp%\$CheckKeyLocked.exe"
- pause&exit
- */
- using System;
- using System.Windows.Forms;
- class CheckKeyLocked
- {
- static void Main(string[] args)
- {
- Console.WriteLine(
- "Caps Lock: "+(Control.IsKeyLocked(Keys.CapsLock)?"ON":"OFF")+"\r\n"+
- "Num Lock: "+(Control.IsKeyLocked(Keys.NumLock)?"ON":"OFF")+"\r\n"+
- "Scroll Lock: "+(Control.IsKeyLocked(Keys.Scroll)?"ON":"OFF"));
- }
- }
复制代码
|