Help with batch file, close TV app after timeout

By Ohmster
Oct 14, 2016
Post New Reply
  1. Use a Windows Batch file as a sleep timer for WinTV

    I need some help with a Windows batch File please. My PC monitor shares an HDTV box for TV. I have a Hauppauge WinTV hvr-1600 TV tuner card and often watch TV while at PC on monitor 2 or full screen monitor 1. I can switch monitor to HDMI input to see my shows in HD. The WinTV card only allows input on cable tuner, channel 3. Since I spend so much time on the PC, the monitor nor the HDTV box have sleep timers, I need one for Windows. I have a terrible time trying to sleep and will listen to background TV while falling asleep, and want a sleep timer to turn it off. Since Windows 10 took away Windows Media Center, I cannot use the user created sleep timer for it. The WinTV8 app does not have a sleep timer and when I wrote tech about it, they suggested I use a simple batch file for this purpose. The tech gave me a crude example:

    timeout /t 1800
    taskkill /IM "C:\Program Files (x86)\WinTV\WinTV8\WinTV8.exe"

    This sounds good but is way too crude as it is hard coded to 30 minutes. What I want to do start the WinTV application and then have the batch file ask the user in command prompt how many minutes for sleep timer. If user inputs 90 at keyboard for minutes, have the batch file multiply 90x60=5400 seconds. Store this new value as a variable such as "time", then run the first line of crude batch:

    timeout /t "time"
    and then finish up by killing the app when the conditions of line 1 are met, 5400 seconds have passed so the WinTV task is killed.

    I have not done batch files in decades and certainly not with Windows 10. Can someone help me with this please? Show me a working example or work with me to produce one? This on the surface does not appear very difficult to do, I just do not know enough about batch files to capture user input, assign it to a variable, and then recall the variable when necessary. Any help would be appreciated, thanks!

Similar Topics

Add your comment to this article

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...