Board logo

标题: 开机检测,各位给点意见 [打印本页]

作者: lzbow     时间: 2010-4-14 20:29    标题: 开机检测,各位给点意见

@echo off
tasklist >%windir%\temp\task.txt
type %temp%\task.txt|find "Clsmn.exe"
if "errorlevel"=="0" goto exit
if "errorlevel"=="1" goto clsmn
:exits
del /q %windir%\temp\*.*
exit
:clsmn
start %system32%\clsmn.exe
del /q %windir%\temp\*.*
exit

[ Last edited by lzbow on 2010-4-15 at 09:01 ]
作者: Hanyeguxing     时间: 2010-4-14 21:28
1,既然两个标签都运行del /q %windir%\temp\*.* ,不如就把他放上面,不放在标签里
2,tasklist直接可查询Clsmn.exe,也可以省略所有的del命令,因为没必要生成临时文件
3,goto 到的批处理最后一行直接就结束了,没必要在最后面使用exit
4,默认环境变量里是没有%system32%的
5,goto exit和:exits,至少有一个标签名写错了
整个批处理直接这样写就可以:
tasklist|findstr /i "clsmn.exe"||start %windir%\system32\clsmn.exe

tasklist|find /i "clsmn.exe"||start %windir%\system32\clsmn.exe
[ Last edited by Hanyeguxing on 2010-4-14 at 21:31 ]