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

Click For Summary
An acquaintance is looking to automate the playback of a dawn song for Purple Martins between 4 AM and 8 AM using a batch file. The discussion suggests using Windows Task Scheduler to start and stop VLC media player, which can play audio files in command line mode with a repeat option. A simple batch file could be created to loop the audio playback, and Task Scheduler can wake the computer to execute the task at the designated time. Alternatively, installing a scripting language like Groovy or Rexx could allow for a more customized solution that monitors time and controls playback, assuming the computer remains on. The conversation emphasizes the feasibility of these methods for non-programmers.
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.
 
Technology 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 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 ConvenientParking
Thanks for the input, very helfpul. Off to the races. Happy New Year!
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
Replies
1
Views
4K
Replies
74
Views
8K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K