Microsoft Windows Vista Community Forums - Vistaheads
Recommended Download



Welcome to the Microsoft Windows Vista Community Forums - Vistaheads, YOUR Largest Resource for Windows Vista related information.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so , join our community today!

If you have any problems with the registration process or your account login, please contact us.

Driver Scanner

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

microsoft.public.windows.vista.performance maintenance






Speedup My PC
Reply
  #1 (permalink)  
Old 09-10-2008
hbfavor
 

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

Apologize if this has been covered elsewhere, but I haven't been able to
find it.

I'm using Vista32HP. In Win98 & NT I've been able to play wav files
from command scripts, but in Vista nothing I've tried seems to work. Can
anyone tell me how to do it? Thanks,


--
hbfavor
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-11-2008
Gmo.-
 

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

Do you mean, play files from "command line" (cmd) ???
If you do, yep, it can be done...
Type in command prompt (or compose a batch file to do it...)

<audio_program> /play /close <file>

Ex. to launch WMP to play a wav file
%ProgramFiles%\Windows Media Player\wmplayer.exe /play /close
C:\music\1.wav
---------------------
hope it's work for you


--
Gmo.-
Reply With Quote
  #3 (permalink)  
Old 09-11-2008
hbfavor
 

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

Thanks for the reply, but that syntax doesn't work for me with any media
player so far.

I really need this functionality to run from a batch/cmd file for
audible cues for certain events. I don't want to see the player
interface, and I want it to exit after playing the wave file. I've been
trying to get this kind of command to work:
start /min "player.exe" /play /close "wavefile.wav"

With some media players I can get them to start minimized and play the
file, but then they try to parse the /play /close switches as media
files and stop with error messages. They also move the active window to
the media player. With WMP, it starts but doesn't play the file, much
less exit gracefully.

I know there has to be a simple way to get this done. I just can't
figure out how. :cry: Any advice would be much appreciated.


--
hbfavor
Reply With Quote
  #4 (permalink)  
Old 09-11-2008
propman
 

Posts: n/a
Re: How can I play a Wav file from batch/cmd script?
hbfavor <guest@unknown-email.com> wrote in
news:fdeb5ca3e6aeeabfa76b2cea7763ae20@nntp-gateway.com:

>
> Thanks for the reply, but that syntax doesn't work for me with any

media
> player so far.
>
> I really need this functionality to run from a batch/cmd file for
> audible cues for certain events. I don't want to see the player
> interface, and I want it to exit after playing the wave file. I've

been
> trying to get this kind of command to work:
> start /min "player.exe" /play /close "wavefile.wav"
>
> With some media players I can get them to start minimized and play the
> file, but then they try to parse the /play /close switches as media
> files and stop with error messages. They also move the active window

to
> the media player. With WMP, it starts but doesn't play the file, much
> less exit gracefully.
>
> I know there has to be a simple way to get this done. I just can't
> figure out how. :cry: Any advice would be much appreciated.
>
>


Media Player Classic download:

http://sourceforge.net/project/showf...roup_id=205650

Install in any directory of your choosing.

Run program and then click on the Help button for Commandline
Switches....or open Command Prompt session in the directory where you
installed mplayerc.exe; type "mplayerc /help".




Reply With Quote
  #5 (permalink)  
Old 09-13-2008
MilesAhead
 

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

Just for grins try
start /min file.wav

Start should open the wav file with whatever is associated with .wav
files.


--
MilesAhead

"How come we don't know the I.Q. of the guy who invented the test?"
Reply With Quote
  #6 (permalink)  
Old 09-13-2008
hbfavor
 

Posts: n/a
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
Reply With Quote
  #7 (permalink)  
Old 09-13-2008
MilesAhead
 

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

Million ways to skin the cat. You might want to investigate
AutoIt3 scripting language. It's free and gives you a lot
more control. It's great for launching other apps and
even sending keystrokes once they are open.

As an example, I made a general purpose AutoIt3 app
to launch another application or open a file with
the associated app, move it to x y pos on screen
and optionally resize the window in about 20 lines
of code.

Batch scripting is okay but AutoIt makes it easier
to do error checking and reporting and has a syntax
that's easy for anyone who has used batch or
bash, or Rexx, or Basic. Plus you can right click
on the script and compile it to .exe so that having
the interpreter on the target machine is not an issue.


--
MilesAhead

"How come we don't know the I.Q. of the guy who invented the test?"
Reply With Quote
  #8 (permalink)  
Old 09-13-2008
hbfavor
 

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

Sounds really useful. Will definitely check it out.


--
hbfavor
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with a Batch file script (FTP) MariusK microsoft.public.windows.vista.general 2 08-01-2008 02:13
execution of batch script fails on vista machine Monolisa microsoft.public.it.windows.vista 0 02-21-2008 12:21
How to play sounds from a batch file Bob microsoft.public.windows.vista.general 9 01-02-2008 02:37
batch file calling exe file problem JPS microsoft.public.windows.vista.security 1 12-20-2007 02:18
"Load Driver" da File batch/ Script /riga di comando: Possibile ? Come ? Auto microsoft.public.it.windows.vista 1 07-12-2007 16:16




All times are GMT +1. The time now is 15:20.




Driver Scanner - Free Scan Now

Vistaheads.com is part of the Heads Network. See also XPHeads.com , Win7Heads.com and Win8Heads.com.


Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.0 RC 2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120