I have a batch file playing a sound in the background while it runs, using the method at Batch file executing a sound silently however, when I exit the batch file, the music will continue to play.
Id there any way to run a command while a batch file is closing, so that the sound file will stop playing?
I've tried an example I found called onexit:
onexit taskkill /im wmplayer.exe
But it doesn't work.
Just :
Should work.