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

In summary, the acquaintance is building houses for Purple Martins, and he wants to play audio 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. 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?
  • #1
ConvenientParking
3
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
  • #2
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
  • #3
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
  • #4
Thanks for the input, very helfpul. Off to the races. Happy New Year!
 

1. How can I create a batch file that will open a media player at a specific time?

To create a batch file that opens a media player at a specific time, you will need to use the Windows Task Scheduler. This allows you to schedule tasks, such as opening a program, at a specific time and date.

2. How do I specify the time in the batch file to open the media player?

You can specify the time in the batch file by using the "schtasks" command. This command allows you to specify the time and date in a specific format, such as "HH:MM" for hours and minutes.

3. Can I use different media players with the batch file?

Yes, you can use any media player that is installed on your computer. Simply replace the file path in the batch file with the file path of the media player you want to open.

4. Can I schedule the batch file to open the media player on a recurring basis?

Yes, you can schedule the batch file to open the media player on a recurring basis by setting up a recurring task in the Windows Task Scheduler. This allows you to choose a specific interval for the task to be repeated.

5. Is it possible to add additional commands or actions to the batch file?

Yes, you can add additional commands or actions to the batch file, such as playing a specific song or playlist, by using the "start" command. This allows you to open a file or program with specific instructions.

Similar threads

  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
4
Views
5K
  • Computing and Technology
Replies
30
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
10K
Replies
74
Views
7K
Replies
9
Views
980
Replies
10
Views
2K
Back
Top