closing wmplayer from a batch file

Steve Tomsic

Reputable
Apr 15, 2014
2
0
4,510
when wmplayer .exe is opened in a batch file to play a .wav file, its window remains open and must be closed manually. The batch file does not execute the next instruction, so using something like 'taskkill' will not work.
 

dalaran

Distinguished
Jun 7, 2011
180
0
18,710
Do you mean the command window (batch file) stays open or that wmplayer stays open (which it should)

If you want the command window to close itself use

START wmplayer.exe

the start command will start the process and then proceed to the next command in the script without waiting for wmplayer.exe to end

Edit : If you want both the command window and batch window to close once the file is done playing

One way you could do it if you know how long the sound file takes to play is to do

START wmplayer.exe ...
TIMOUT /T 10

where the number after timout is a number of seconds that should correspond to the time of your file....

If you don't know the length of the sound file the other solution would be to find a player that has a command line option to close once the file is done playing, I don't know any so you'd have to do some research on that.
 

TRENDING THREADS