Last active
January 13, 2017 18:21
-
-
Save anteriovieira/15189ac5892297868af7139c10d8dfb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Script to play a song | |
REM Example: | |
REM to-play.cmd url_to_file|path_to_file | |
REM Set file name | |
set file=%1 | |
REM Create temp file | |
( | |
echo Set player = CreateObject("WMPlayer.OCX.7"^) | |
echo player.URL = "%file%" | |
echo player.Controls.play | |
echo do while player.currentmedia.duration = 0 | |
echo wscript.sleep 100 | |
echo loop | |
echo wscript.sleep (int(player.currentmedia.duration^)+1^)*1000 | |
) > %USERPROFILE%\player.vbs | |
REM Start player with song | |
echo Playing song... && "%USERPROFILE%\player.vbs" ^&^& exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment