0

My goal is to create a script which when running, will make go into shared network drive and play all mp3 in the directory

Add-Type -AssemblyName presentationCore
$mediaPlayer = New-Object system.windows.media.mediaplayer
$data = gci "\\srv\s$\music\"
foreach ($line in $data){
    $mediaPlayer.open("\\srv\s$\music\$line")
    $mediaPlayer.Play()
    
    
}

the script has no way to know if the mp3 is done, so what happens is that it "plays" for a milisecond and then moving forward to next item. this will cause only the last file to be played. is there a way i can make powershell "know" when an mp3 is dont playing?

Shahar
  • 461
  • 5
  • 16

0 Answers0