@echo off 
color 0a
title windows7系统服务检查---
echo 检查拨号程序运行需要的几个服务状态。在没看到结尾信息时 
echo 请勿关闭本窗口。 
echo 正在检查，请稍后...... 
echo 
echo 

echo 检查注册表项目，删除可能导致故障的键值...
reg delete "HKLM\SYSTEM\CurrentControlSet\services\eventlog\Parameters" /f

echo 检查windows event log服务，需要自动启动，并且处于启动状态
echo .
sc queryex eventlog 
sc config eventlog start= auto
for /F "usebackq skip=3 delims=:  tokens=2-3" %%s in (`sc queryex eventlog`) do if "%%s" == " 4  RUNNING " goto next1 
sc start eventlog
ping 127.0.0.1 -n 20 > null

:next1
echo 检查Secure Socket Tunneling Protocol Service服务，需要手动启动，并且处于启动状态
sc queryex SstpSvc 
sc config SstpSvc start= demand
for /F "usebackq skip=3 delims=:  tokens=2-3" %%s in (`sc queryex SstpSvc`) do if "%%s" == " 4  RUNNING " goto next2 
sc start SstpSvc
ping 127.0.0.1 -n 20 > null

:next2
echo 检查Remote Acess Auto Connection Manager服务，需要手动启动，并且处于启动状态
sc queryex RasAuto 
sc config RasAuto start= demand
for /F "usebackq skip=3 delims=:  tokens=2-3" %%s in (`sc queryex RasAuto`) do if "%%s" == " 4  RUNNING " goto next5 
sc start RasAuto
ping 127.0.0.1 -n 20 > null


:next5
echo 检查Remote Access Connection Manager服务，需要手动启动，并且处于启动状态
sc queryex RasMan 
sc config RasMan start= demand
for /F "usebackq skip=3 delims=:  tokens=2-3" %%s in (`sc queryex RasMan`) do if "%%s" == " 4  RUNNING " goto next3 
sc start RasMan
ping 127.0.0.1 -n 20 > null

:next3
echo 检查Telephony服务，需要手动启动，并且处于启动状态
sc queryex TapiSrv 
sc config TapiSrv start= demand
for /F "usebackq skip=3 delims=:  tokens=2-3" %%s in (`sc queryex TapiSrv`) do if "%%s" == " 4  RUNNING " goto next4
sc start TapiSrv
ping 127.0.0.1 -n 20 > null

:next4
echo 检查完成，现在重新启动校园宽带程序.....
echo .
echo .

echo .
echo.