Batch file that will open a media player at a specific time

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 3K views
ConvenientParking
Messages
3
Reaction score
3
I have an acquaintance who's building houses for Purple Martins. He has audio he wants to play between 4AM and 8 AM local time that's supposed to be a dawn song for the birds. He's seeking a way to automatically play this audio on loop. I'm sure there are a million easier ways to do this, but my first thought was a batch file. I'm not any kind of programmer and I'm not familiar with DOS commands. But there has to be an easy enough way to accomplish this with a batch file, no? Run the batch file the night before, command prompt waits until the time to launch a media player set to run one audio file on a loop for 4 hours, and after 4 hours command prompt will exit the media player.

Obviously Windows, and obviously two dummies thinking about this. Thanks in advance for any help.
 
Physics news on Phys.org
One way to do it ...

1. Use Task Scheduler to start and stop the VLC media player.
2. VLC in command line mode accepts a media file name, and has a -repeat switch that loops back to the beginning.
 
  • Like
Likes   Reactions: ConvenientParking and jedishrfu
There's no builtin script command to do this in Windows. However this article may help you configure a script to run a command at a certain time using the Task Scheduler of Windows:

https://www.groovypost.com/howto/schedule-wake-sleep-windows-automatically/

It looks like you could write a simple batch file:

Bash:
:playclip
command to play audio clip
goto playclip

and then schedule it for some time and then expire it after so many hours using the TaskScheduler. The TaskScheduler would wakeup the computer to run the task.

Playing audio clips:

https://www.computerhope.com/issues/ch001041.htm

Alternatively, you could install a scripting language like Groovy or Rexx or some other Windows scripting language and code a loop that would monitor the time and then play your clip and then stop it at sometime. This would presume the computer is always on.
 
  • Like
Likes   Reactions: ConvenientParking
Thanks for the input, very helfpul. Off to the races. Happy New Year!