@echo off
:SLEEP
TIMEOUT /T 60 /NOBREAK
:CHECK
echo %TIME% | findstr 23:5 >nul
if not errorlevel = 1 goto END
WMIC PROCESS WHERE NAME="java.exe" get commandline | findstr /i helloworld >nul
if not errorlevel goto RUNNING
:RUN
cd /D W:\external\input\input-trigger
if exist *-* (
echo %date% - %time% - trigger file exist, start up the run.bat >>d:\temp\log.txt
call d:\apps\run.bat
goto SLEEP
) else (
echo %date% - %time% - trigger file does not exist >>d:\temp\log.txt
goto SLEEP
)
:RUNNING
echo %date% - %time% - helloworld is running >>d:\temp\log.txt
goto SLEEP
:END
原文:http://www.cnblogs.com/wencle/p/5348494.html