I am running Windows-7. I want to create a Windows Batch file which works like this:
- Run an exe with specified arguments. Wait for the complete execution of this exe. (This EXE is essentially recording an online video stream and is supposed to record it for 1 hour 5 minutes)
- If, however, exe exits (stops recording & exits execution) before the stipulated time period (1 hour 5 minutes), execute the same exe with different argument for the remaining duration. Kill the EXE execution when the total time period (including EXE's first tun in Step 1) reaches 1 hour 5 minutes.
- Continue to execute the exe with different argument till the cumulative time duration reached 1 hour 5 minutes.
- Kill the EXE execution and exit the batch file execution when the batch file has run for 1 hour 5 minutes.
Note: The exe takes two arguments: input stream address and the output filname. The only argument which changes in each run of the EXE above is the file name which changes from "FileName" in the first run to "FileName2" when the first run exits before 1 hour 5 minutes. And the filename is to be incremented to Filename2, Filename3 and so on till the cumulative run time of this batch file reaches 1 hour 5 minutes. For a real example, see this command:
"C:\Windows\System32\rtmpdump.exe" -i rtmpt://154.500.69.6/live -o "C:\Users\user\Desktop\Filename.extension"
The command mentioned above is what is to run the first time. In subsequent runs (which are necessitated only if this first execution exits before the goal of 1 hour 5 minutes), only the file name needs to be changed to Filename2.extension as shown in command below:
"C:\Windows\System32\rtmpdump.exe" -i rtmpt://154.500.69.6/live -o "C:\Users\user\Desktop\Filename2.extension"
And this sequence needs to continue till the cumulative run of this batch file reaches 1 hour 5 minutes.