Home > Back-end >  Advice with a simple batch file - run on Windows start - terminate program after time limit - run ag
Advice with a simple batch file - run on Windows start - terminate program after time limit - run ag

Time:12-20

Long time reader of these forums however I now have a question of my own, if someone could be so kind as to point me in the right direction.

I have a simple batch file "OBS Startup.bat" which contains the following single line; start /d "C:\Program Files\obs-studio\bin\64bit" obs64.exe --startstreaming

This allows me to start OBS (streaming software) and start streaming all in one click.

Due to limitations with YouTube, I want to stop streaming every six hours, then immediately start the above bat file again to continue where I left off.

Long story short, I am after altering the above bat file, to achieve the following;

  1. Have the bat file run on Windows startup,
  2. Have the OBS program terminated after six hours,
  3. Have the bat file run again as soon as it terminates in step 2.

Hope all this makes sense.

Any advice would be much appreciated.

Many thanks.

CodePudding user response:

May be something like this:

@echo off

:Repeat
start /d "C:\Program Files\obs-studio\bin\64bit" obs64.exe --startstreaming
timeout /t 21600 > nul
taskkill /im "obs64.exe" /f
goto :Repeat

You may have to run this as administrator..

  • Related