Reputation: 127
Quite new to batch script, please help me out.
set Pathname="C:\S3Sync"
cd %Pathname%
S3Sync.exe -
timeout /t 10
taskkill /im S3Sync.exe
I want to run the following process and if it stops or goes into an infinite time period, kill the process after 10 seconds and also use try and catch to get the error. what are the possibilities of using such statement?
Upvotes: 0
Views: 502
Reputation: 41234
These commands may help you: Put them after the timeout
command
set err=%errorlevel%
tasklist |find /i "s3sync.exe" >nul && taskkill /f /im S3Sync.exe
If your task hangs then the errorlevel will not be set correctly, of course.
Upvotes: 1