@echo off for /f "delims=" %%t in ('winsw.exe status') do set str=%%t echo %str% if %str%==Started ( winsw stop @echo wait program stop ..... PING 127.0.0.1 -n 30 -w 10000 >NUL )