Thursday 15 May 2014

Having issues making a simple script in powershell run windows media player in the background -



Having issues making a simple script in powershell run windows media player in the background -

i trying simple script want portion of script run in background. want run windows media player in background. brand new powershell , scripting in general, having whole day , half under belt. can help me out , explain in basic terms how start job works invoke-item. give thanks help can provide.

here original script. wanted launch powerpoint , have media player come little after got load. realize in powerpoint, using seek , learn. got work:

#call ssd $musicpath = "c:\powershell\windows_exclamation.wav" $powerpoint = "c:\powershell\ssd.ppsx" invoke-item $powerpoint start-sleep -s 3 invoke-item $musicpath

i wanted media player run in background. here script far:

#call ssd $musicpath = "c:\powershell\windows_exclamation.wav" $powerpoint = "c:\powershell\ssd.pptx" invoke-item $powerpoint start-sleep -s 3 start-job -scriptblock {invoke-item} $musicpath

should using invoke-command or lost in sauce here?

i'd utilize media.soundplayer object.

$musicpath = "c:\windows\media\windows exclamation.wav" function playwav($path){(new-object media.soundplayer "$path").play();} playwav -path "$musicpath"

powershell windows-media-player

No comments:

Post a Comment