批处理no.bat

在公司每次我启动电脑, 网络连接需要一段时间, 而我想在这段小时间里面, 一旦网络连接成功就帮我启动微信和qq, 如果还没有连接成功就继续监测直到有网络了才会成功才会打开两个程序, 当打开程序后脚本自动校测关闭.

::Final interpretation is owned by chenglee
::Thankyou
::温馨提示:如果放在win启动计划中,如需要就开启第六行代码,
::作用是检测完马上自动关闭检测脚本待下次运行, 如果不开启就是检测完停留等待手动关闭,
::作用:窗口叠加
::@echo off<nul 3>nul
@echo off&title Checking For System, Do Not Switch Off, Thankyou...
:2
color 0E
type nul>chengip.txt
ipconfig | findStr "默认网关" >> chengip.txt
findstr /r 192.168 "chengip.txt"  >NUL 2>NUL
::if not "%%a"=="%num%" goto en1
IF ERRORLEVEL 1 goto 1
IF ERRORLEVEL 0 goto 0
  
  
:0
echo.Network Succes!
echo.start QQ!!
choice /t 5 /d y /n >nul
start "" "C:Program Files (x86)TencentQQBinQQ.exe"
::start notepad chengip.txt
echo.start WeChat!!
choice /t 5 /d y /n >nul
start "" "C:Program Files (x86)TencentWeChatWeChat.exe"
echo.程序启动完毕!
choice /t 2 /d y /n >nul
echo.准备清除文件内容!
choice /t 5 /d y /n >nul
cd.>chengip.txt
echo.文件清除完毕,准备退出程序!
choice /t 5 /d y /n >nul
exit
  
:1
echo.Network Not!
set filename=%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2%
echo %filename%
echo.网络正在连接,请稍后...
choice /t 5 /d y /n >nul
goto 2
pause
exit

  

原文地址:https://www.cnblogs.com/chenglee/p/9719105.html