
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