This is timeout command for Operating System to define maximum time for execution of a program .
Ubuntu Timeout Command
timeout 5s a.exe < input.txt
Windows Command :
In windows it needs to make three batch file
**process.bat**
@ECHO OFF
start /b cm.bat
start cmd.exe /c run.bat
EXIT
**cm.bat**
@ECHO OFF
a.exe < input.txt > out.txt
taskkill /im a.exe /f
taskkill /im cmd.exe /f
EXIT
**run.bat**
@ECHO off
timeout /t 5
taskkill /im a.exe /f
taskkill /im cmd.exe /f
EXIT
Now Run process.bat . it will start both cm.bat and run.bat simultaneously/parallely. When a.exe from cm.bat terminates; cm.bat kills run.bat and thus it will work as ubuntu timeout.
0 comments:
Post a Comment