I have a file called f.wav in my temp folder. I am trying to use powershell's System.Media.SoundPlayer to play the wave file from within powershell.
$PlayWav=New-Object System.Media.SoundPlayer;$PlayWav.SoundLocation='C:\Users\USER\AppData\Local\Temp\f.wav';$PlayWav.playsync()
The above snippet works when I hardcode the files path location without a problem, however when I use the enviroment variable like in the snippet below this it throws an error.
$PlayWav=New-Object System.Media.SoundPlayer;$PlayWav.SoundLocation='$env:TMP\f.wav';$PlayWav.playsync()
The error that is thrown up is: Exception setting "SoundLocation": "The given path's format is not supported."
Is it just not possible using the temp folders enviroment variable?