-
-
Save shakahl/5d28481b058a8060c259481aefc5c97b to your computer and use it in GitHub Desktop.
Powershell Wrapped in batch - a simple song using system beeps
This file contains hidden or 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
goto ExecutePowershell | |
cls | |
#Powershell code block begining | |
#LINK http://www.bryanvine.com/2016/02/powershell-quick-script-wrap-any.html | |
0..2 | %{ | |
"Loop: $($_+1)" | |
[System.Console]::Beep(450, 110);[System.Console]::Beep(500, 110);[System.Console]::Beep(550, 110);[System.Console]::Beep(450, 110) | |
[System.Console]::Beep(675, 200);[System.Console]::Beep(675, 200);[System.Console]::Beep(600, 300);[System.Console]::Beep(450, 110) | |
[System.Console]::Beep(500, 110);[System.Console]::Beep(550, 110);[System.Console]::Beep(450, 110);[System.Console]::Beep(600, 200) | |
[System.Console]::Beep(600, 200);[System.Console]::Beep(550, 300);[System.Console]::Beep(525, 110);[System.Console]::Beep(450, 300) | |
[System.Console]::Beep(450, 110);[System.Console]::Beep(500, 110);[System.Console]::Beep(550, 110);[System.Console]::Beep(450, 110) | |
[System.Console]::Beep(500, 400);[System.Console]::Beep(600, 300);[System.Console]::Beep(500, 400);[System.Console]::Beep(475, 200) | |
[System.Console]::Beep(450, 200);[System.Console]::Beep(400, 200);[System.Console]::Beep(600, 500);[System.Console]::Beep(525, 500) | |
[System.Console]::Beep(450, 110);[System.Console]::Beep(500, 110);[System.Console]::Beep(550, 110);[System.Console]::Beep(450, 110) | |
[System.Console]::Beep(675, 200);[System.Console]::Beep(675, 200);[System.Console]::Beep(600, 300);[System.Console]::Beep(450, 110) | |
[System.Console]::Beep(500, 110);[System.Console]::Beep(550, 110);[System.Console]::Beep(450, 110);[System.Console]::Beep(800, 200) | |
[System.Console]::Beep(500, 200);[System.Console]::Beep(550, 300);[System.Console]::Beep(525, 110);[System.Console]::Beep(450, 300) | |
[System.Console]::Beep(450, 110);[System.Console]::Beep(500, 110);[System.Console]::Beep(550, 110);[System.Console]::Beep(450, 110) | |
[System.Console]::Beep(500, 400);[System.Console]::Beep(600, 300);[System.Console]::Beep(500, 400);[System.Console]::Beep(475, 200) | |
[System.Console]::Beep(450, 200);[System.Console]::Beep(400, 200);[System.Console]::Beep(600, 500);[System.Console]::Beep(525, 500) | |
} | |
exit | |
#end of powershell code - batch code now: | |
:ExecutePowershell | |
echo off | |
set filename=%temp%\Tempscript.ps1 | |
copy /y %0 %filename% | |
echo NOTE - you will see error output in the error stream about 'goto' - this is expected and can be ignored. | |
cls | |
powershell -ExecutionPolicy unrestricted -file %filename% %* | |
set /a el=%errorlevel% | |
del %filename% | |
exit %el% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment