Shell Command Calling Winamp.exe to Play an MP3 File 
Author Message
 Shell Command Calling Winamp.exe to Play an MP3 File

I never expected spending hours on a simple shell command line!  This was
what I wrote to call winamp.exe to play an mp3 file:

dim sng as string
sng = "C:\My Song.mp3"
Call Shell("C:\Program Files\Winamp\Winamp.exe " & sng)

I could call Winamp with this but could not correctly load the song.  Winamp
saw "My Song.mp3" as two songs, probably because of the space in the song
name.  I checked everything for a solution, including the official Winamp
site, but could not find any clue.  After hours of experimenting, I finally
found out that if there were spaces in the song name, the song name had to
be delimited with a pair of double quotations.   I changed my code and now
it works:

sng = chr(34) &  "C:\My Song.mp3" & chr(34)
Call Shell("C:\Program Files\Winamp\Winamp.exe " & sng)

If you want to load more than one song, simply stack the song names:

sng = chr(34) &  "C:\My Song 1.mp3" & chr(34) & chr(34) &  "C:\My Song
2.mp3" & chr(34)

If you want to add songs using the "/ADD" parameter, the same syntax applies
as well.

There does not seem to be any direct documentation on this.  It might be
trivial but I hope it helps someone.

Kelvin Fun



Tue, 14 Sep 2004 18:33:14 GMT  
 Shell Command Calling Winamp.exe to Play an MP3 File

Quote:

> [need double quotes around long filenames with spaces]

This applies very generally. For example, on the MS-DOS command line:

del some file.txt
...gives an error (too many parameters) but...

del "some file.txt"
...does what you'd expect.

Eq.

--

Equinox Tetrachloride
www.cl4.org - www.insecurities.org



Tue, 14 Sep 2004 19:41:49 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Playing MP3 Files In WinAmp

2. Control WinAMP, get filename of playing MP3

3. Win API call to play MP3 audio files

4. Winamp audio player (MP3),realaudio player control and store .wav file in database

5. Winamp audio player (MP3),realaudio player control and store .wav file in database

6. Win APIs to play mpg video files, mp3 audio files and audio cds

7. Help i need an Mp3 control that plays mp3's

8. PostMessage to WinAmp mp3 player

9. playing mp3-files

10. How to play MP3 file when document opens

11. how to play mp3 files?

12. How to play MP3 file ?

 

 
Powered by phpBB® Forum Software