Re: How can I play a Wav file from batch/cmd script?




Milesahead - thanks for the tip. Your method does absolutely work, but
the problem is that it leaves us with a media player hanging around in
memory, even if minimized. It also retains the active window, even if
the batch file continues other operations.

Surprisingly to me, there's relatively little forum chatter on this
specific topic under Vista, but after rooting around I did come up with
a method that works fine. Requires 3 lines in a batch file:

start /min "mediaplayer" "mediafile"
timeout /T "N"
taskkill /IM "mediaplayer"

Your method for playing the file is shorter & more elegant, but this
allows selecting the media player for type of file (for instance, one
player for flac files, another for mp3s).
The timeout command is necessary, because otherwise the following
command, taskkill, will kill the mediaplayer task before it has a chance
to play the sound file. Switch /T N refers t the seconds you want to
command processor to wait before loading the next line of the batch file
(no quotes for seconds number) Also means you have to have a rough idea
of how many seconds the soundfile takes, but that's not a big deal.
The taskkill command zaps the program from memory. For this operation
you don't need a fully qualified path name, since it is looks fo the
image name (vlc.exe, for example) that is in the task list. Finally, if
you want to avoid extraneous info sent to the screen, redirect lines 2
and 3 to nul.

Thanks again for taking an interest.


--
hbfavor
.



Relevant Pages

  • Re: Windows XP SP 2 Operating System Freeze
    ... I had given up on this, but I just recently upgraded my memory from 512mb to ... XP Home SP2 upgrade to an ME system. ... didn't crash when the Media Player failed. ... Nothing is written to the event logs. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Windows Media Player Memory Leak
    ... I am using the Windows Media Player control to handle> the streaming video. ... I'm using the runtime library> memory debugging routines to find memory leaks, but> there do not appear to be any in my code I also verified that I am> releasing all of my Media Player interface pointers after each playback. ...
    (microsoft.public.windowsmedia.sdk)
  • hwo to undo the windows Media player under DOS?
    ... Boot the computer in "Safe Mode with Command Prompt" ... uninstall Windows Media Player: ... Empty the C:\Program Files\Windows Media Player folder. ... >DOS command for undoing the installation of Media ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: CPU Too High
    ... > After opening and closing out of any program, my processor monitor is ... > close back to desktop then open say Media player and view a video ... It's a 1.5GHz Intel Celeron M and the video card has it's own ... > memory and the system has 750+ MB of memory and Ive closed out and ...
    (microsoft.public.windowsxp.general)
  • Re: windows media player crashes frequently
    ... If you can get me a fault bucket number here, ... This posting is provided "AS IS" with no warranties, and confers no rights. ... as soon as the installation is over and windows media player starts, ... memory 0x370036b4 referenced at 0x00000428.. ...
    (microsoft.public.windowsmedia.player)