I am trying to add this line in the bat file.... >> "%systemdrive%\oops.vbs" echo objWSS.Run cRUN & Chr(34) & cWAV & Chr(34),0,True Update: Solution....>> "%systemdrive%\oops.vbs" echo objWSS.Run cRUN ^& Chr(34) ^& cWAV ^& Chr(34),0,True By the way....thanks Tito for trying for me but searchengine doesnt allow ppl to pm him so I dont know how to reach him unfortuantly. Glad my neighbor (John) is a geek. lol Thanks alot to him for his help on this. Here is solution that works... Set wmp = CreateObject("WMPlayer.OCX") wmp.settings.autoStart = True wmp.URL = "C:\oops.wav" while wmp.Playstate <> 1 WSH.Sleep 100 wend But I would like to now use %systemdrive% in place of C:\ but the script wont take it. Is there a way of making it take %systemdrive% instead of full path for I have OS on D:\ on one machine and C:\ on another. Would like it to be versatile so I dont have to make one for each computer. My neighbor doesnt know so I thought I would ask here. Thanks
not entirely sure what you are trying do, but .vbs cannot execute %systemdrive% directly, but the following edited example of above uses 'ExpandEnvironmentStrings()' to identify '%systemdrive%' RED = added or changed (also added 'volume = 50%') save as 'oops.vbs' Code: Set wshell = CreateObject("WScript.Shell") sysdrive = wshell.ExpandEnvironmentStrings("%SYSTEMDRIVE%") Set wmp = CreateObject("WMPlayer.OCX") wmp.settings.autoStart = True wmp.settings.volume = 50 wmp.URL = (sysdrive + "\oops.wav") while wmp.Playstate <> 1 WSH.Sleep 100 wend BTW: if you want to write this 'oops.vbs' from .cmd file, the .cmd file would look like this... save as 'oops.cmd' Code: @echo off (echo Set wshell = CreateObject^("WScript.Shell"^) echo sysdrive = wshell.ExpandEnvironmentStrings^("%%SYSTEMDRIVE%%"^) echo Set wmp = CreateObject^("WMPlayer.OCX"^) echo wmp.settings.autoStart = True echo wmp.settings.volume = 50 echo wmp.URL = ^(sysdrive + "\oops.wav"^) echo. echo while wmp.Playstate ^<^> 1 echo WSH.Sleep 100 echo wend) >%systemdrive%\oops.vbs