[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] 请教WIN10下能用的批处理系统空闲时间监测

在WIN10 下 鼠标键盘多久时间没动 就执行程序,比如说自动关机。
论坛里面搜出来的几个WIN10 下好像都不能执行。

回复 1# conan2095


    你搜到的是哪几个?我试试能否修改成Win10能用的。
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

回复 2# Batcher


    http://www.bathome.net/thread-20370-1-1.html

大哥是这个帖子

TOP

  1. #@&cls&powershell "type %~s0|out-string|iex"&pause&exit
  2. Add-Type @'
  3. using System;
  4. using System.Runtime.InteropServices;
  5. public static class GetIdleTime {
  6.     [DllImport("user32.dll")]
  7.     public static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
  8.     [StructLayout(LayoutKind.Sequential)]
  9.     public struct LASTINPUTINFO {
  10.         public int cbSize;
  11.         public uint dwTime;
  12.     }
  13.     public static long IdleTime{
  14.         get {
  15.             LASTINPUTINFO lii = new LASTINPUTINFO();
  16.             lii.cbSize = Marshal.SizeOf(lii);
  17.             if (!GetLastInputInfo(ref lii)) return 0;
  18.             return Environment.TickCount - (uint)lii.dwTime;
  19.         }
  20.     }
  21. }
  22. '@
  23. while(!(sleep 1)){
  24.     if([getidletime]::IdleTime/1000 -gt 3){"空闲时间大于3秒"}
  25. }
复制代码

TOP

返回列表