1.

Solve : Run Windows Media Player in Background?

Answer»

Hi All,

I'm trying to right a batch file that will run a .wav file in WMP in the background so the user won’t see the WMP window. At the moment here is the following code I've written.

--------------------------------
start /MIN "wmplayer.exe" "C:\Users\Owner\Desktop\wavFiles\8point1.wav"
timeout /T 3
taskkill/IM "wmplayer.exe"
------------------------------------------------

The problem with this code is that the WMP window does show and does not even minimize!

Any help will be very much appreciated!
Try this. It will use an older version of windows media player, but not to worry as the user probably wont see it anyway.
Code: [SELECT]start /min "" "C:\Program Files\Windows Media Player\mplayer2.exe" /play /close "C:\Users\Owner\Desktop\wavFiles\8point1.wav"Make sure the above is ONE LINE.Thanks Helpmeh for your quick reply!

1) I needed to change mplayer2.exe to wmplayer.exe otherwise I'm getting an error that it can't find mplayer2

2) After making the above change if WMP was in Restore mode last time it was open then the first time I run the bat file it executes as I want (the window is not visible) the second time it will show and stay open, if I close it manually and run it again it will run as I wanted the 4th time it won’t and so forth... If the WMP was Maximised last time it was open running the bat file will always run WMP in max mode and stay open.
QUOTE from: Amram Chayim Eirinberg on February 20, 2010, 12:20:58 PM

Thanks Helpmeh for your quick reply!

1) I needed to change mplayer2.exe to wmplayer.exe otherwise I'm getting an error that it can't find mplayer2

2) After making the above change if WMP was in Restore mode last time it was open then the first time I run the bat file it executes as I want (the window is not visible) the second time it will show and stay open, if I close it manually and run it again it will run as I wanted the 4th time it won’t and so forth... If the WMP was Maximised last time it was open running the bat file will always run WMP in max mode and stay open.

Here is a link to download mplayer2.exe. It doesn't require any installation, just copy and past the following file into C:\Program Files\Windows Media Player\.

mplayer2.cnt
mplayer2.exe
mplayer2.hlp
mplayer2.inf
mplayer2.pnf

For some reason, the underlined file (mplayer2.exe) is the only file (in the list I gave) that is in my C:\Program Files\Windows Media Player\ folder, so copy that one first and try out my script. If it doesn't work, copy the rest.
Where is the link? Quite strange...it must not have copied...lol
http://www.infocellar.com/winxp/files/mplayer-winxp-files.zipmplay32 and sndrec32 can also play .wav files.Thanks Prince! Hi Helpmeh


I've updated the batch to mplayer2.exe however I'm getting an error message that the entry point was not found.

I've attached a jpg of the error message

[Saving space, attachment deleted by admin]I really have never seen that error before. It might be because it is for XP, not vista.

To make sure you don't have mplayer2.exe on you COMPUTER (other than the one I gave you), do a search for it, and if it already exists, then it should work with that version.

there is no "mplayer2" included with windows vista.

use Windows Media Player Classic:

http://www.afterdawn.com/software/video_software/video_players/media_player_classic.cfm/v6_4_9_1__20080127_

the switches are pretty similar:

Quote

Usage: mplayerc.exe "pathname" [switches]

"pathname"   The main file or directory to be loaded. (wildcards
      allowed)
/dub "dubname"   Load an additional AUDIO file.
/dubdelay "file"   Load an additional audio file shifted with XXms (if
      file contains "...DELAY XXms...")
/d3dfs      start rendering in D3D fullscreen mode.
/sub "subname"   Load an additional subtitle file.
/filter "filtername"   Load DirectShow filters from a dynamic link
      library. (wildcards allowed)
/dvd      Run in dvd mode, "pathname" means the dvd
      folder (optional).
/dvdpos T#C   Start playback at title T, chapter C
/dvdpos T#hh:mm   Start playback at title T, position hh:mm:ss
/cd      Load all the tracks of an audio cd or (s)vcd,
      "pathname" means the drive path (optional).
/open      Open the file, don't automatically start playing.
/play      Start playing the file as soon the player is
      launched.
/close      Close the player after playback (only works when
      used with /play).
/shutdown   Shutdown the operating system after playback
/fullscreen   Start in full-screen mode.
/minimized   Start in minimized mode.
/new      Use a new instance of the player.
/add      Add "pathname" to playlist, can be combined
      with /open and /play.
/regvid      Create file associations for video files
/regaud      Create file associations for audio files
/unregall      Remove all file associations
/start ms      Start playing at "ms" (= milliseconds)
/startpos hh:mm:ss   Start playing at position hh:mm:ss
/fixedsize w,h   Set fixed window size.
/MONITOR N   Start on monitor N, where N starts from 1.
/help /h /?   Show help about command line switches


so you would use:

Code: [Select]<path to mplayerc>\mplayerc.exe /minimized "%UserProfile%\desktop\wavfiles\8point1.wav" /play /close
Wouldn't /minimized go on the other side of the path, with the other switches?
Quote
Usage: mplayerc.exe "pathname" [switches]
it doesn't matter.ok.


Discussion

No Comment Found