title: Select audio device for VBScript playing sound
body: <p>I'm trying to make a script that plays audio to a specific audio device, because I want to use a virtual audio cable to manage where the audio is going (broadcasting software, discord etc.). I've got a batch script that creates a vbscript that will play the sound. This is the code in the batch script:</p>
  
  <pre><code>@echo off
  set "file=%1"
  ( echo Set Sound = CreateObject("WMPlayer.OCX.7"^)
      echo Sound.URL = "%file%"
      echo Sound.Controls.play
      echo do while Sound.currentmedia.duration = 0
      echo wscript.sleep 100
      echo loop
      echo wscript.sleep (int(Sound.currentmedia.duration^)+1^)*1000) &gt;sound.vbs
  start /min sound.vbs
  </code></pre>
  
  <p>The reason I've got this batch script is so I can do something like <code>PlaySound.bat airhorn.wav</code> to play an audio file.</p>
  
  <p>Is there a possible way to play the sound to a specific audio channel?</p>
  
  <hr>
  
  <p>EDIT: Just to clarify, the script does work and it does play the sound file correctly, but I would like to output the file to a different non-default audio devices which is in my case a virtual audio cable. I don't want to toggle the default audio device I just want to play sound and output that sound to a different non-default audio device.</p>
  
  <hr>
  
  <p>EDIT 2: I've gone with a different solution, which you can see <a href="https://stackoverflow.com/questions/43225260/output-sound-to-audio-device">here</a>.</p>