项目情况
1. 有些程序的启动必须等某些远端服务如数据库成功运行之后才能去启动、去执行
流程图
脚本代码
@echo off
:: %1 -- The first Parameter
set ip=192.168.11.50
set port=3306
:start
nc64 %ip% %port% >nul
if ERRORLEVEL 1 (goto err) else (goto continue)
:err
echo env not ok.
@REM 延时5s
choice /t 5 /d y /n >nul
goto :start
:continue
echo env is ok, start install service.
@REM pause
探测程序
使用netcat 这个程序
下载链接 netcat 1.11 for Win32/Win64
解压
使用
将探测程序跟bat脚本放相同路径下,执行上面bat脚本的时候就能读取到这个exe文件去探测的