Board logo

标题: tasklist检测到屏保进程就关机 [打印本页]

作者: 418180315     时间: 2011-1-8 15:41    标题: tasklist检测到屏保进程就关机

:ss
tasklist >c:\1.txt
find /i "SCR" c:\1.txt
if ERRORLEVEL 0 (shutdown -s -t 0) else ping 127.1 -n 10 >nul 2>nul
goto ss

这个批处理不知道什么地方出问题
我想要的功能是tasklist检测屏保进程    检测到屏保就自动关机
运行后就是关不了机
请各位大侠给我答案

[ Last edited by 418180315 on 2011-1-9 at 17:08 ]
作者: Hanyeguxing     时间: 2011-1-8 16:11

@echo off
:a
tasklist /nh|find /i ".scr">nul 2>&1&&shutdown -s -f -t 0
ping 127.1 -n 10 >nul 2>&1
goto:a

作者: 418180315     时间: 2011-1-8 17:11
运行后 屏保出来 还是没有关机  
有劳大侠再帮我看看
作者: cyn01livecn     时间: 2011-1-17 19:10
将 -t 0 改成 -q
作者: Hanyeguxing     时间: 2011-1-17 21:13


  Quote:
Originally posted by 418180315 at 2011-1-8 17:11:
运行后 屏保出来 还是没有关机  
有劳大侠再帮我看看

批处理不能以 tasklist、shutdown、ping 命名,否则递归1240次后批处理自己就挂了。。。

[ Last edited by Hanyeguxing on 2011-1-17 at 21:14 ]