My OS is Windows 10 (64bits) French Edition : GetFunky_ASCII_ART_Colors.bat
Code: Select all
<# : batch script section , Don't Delete This Line.
@rem # The previous line does nothing in Batch, but begins a multiline comment block in PowerShell. This allows a single script to be executed by both interpreters.
@echo off
Title Get Funky ASCII ART with Colors and Playing music in the background by Hackoo 2022
setlocal
cd "%~dp0"
Color 0B & echo(
Echo( This ASCII ART with playing music in the background is interpreted with powershell command ....
Powershell -executionpolicy bypass -Command "Invoke-Expression $([System.IO.File]::ReadAllText('%~f0'))"
EndLocal
@rem # Here you can put other Commands in batch
cls & Echo( Those are another examples of commands with Batch like ping and ipconfig /all and so on ....
Timeout /T 1 /NoBreak>nul
Ping www.google.com
echo( & Ipconfig /all & pause
goto:eof
#>
# here write your powershell commands...
###################################################################################################################
# https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/listening-to-music-in-the-background
###################################################################################################################
function Start-Music
{
$code = {
$player = New-Object -ComObject 'MediaPlayer.MediaPlayer'
$player.Open('http://www.leeholmes.com/projects/ps_html5/background.mp3')
$player
}
$script:ps = [PowerShell]::Create()
$script:player = @($ps.AddScript($code).Invoke())[0]
}
function Stop-Music
{
if ($script:player -ne $null)
{
$script:player.Stop()
Remove-Variable -Name player -Scope script
}
if ($script:ps -ne $null)
{
$script:ps.Runspace.Close()
$script:ps.Dispose()
Remove-Variable -Name ps -Scope script
}
}
###############################################
# https://stackoverflow.com/a/35022366/3080770
###############################################
function Get-Funky{
param([string]$Text)
# Use a random colour for each character
$Text.ToCharArray() | ForEach-Object{
switch -Regex ($_){
# Ignore new line characters
"`r"{
break
}
# Start a new line
"`n"{
Write-Host " ";break
}
# Use random colours for displaying this non-space character
"[^ ]"{
# Splat the colours to write-host
$writeHostOptions = @{
ForegroundColor = ([system.enum]::GetValues([system.consolecolor])) | get-random
# BackgroundColor = ([system.enum]::GetValues([system.consolecolor])) | get-random
NoNewLine = $true
}
Write-Host $_ @writeHostOptions
break
}
" "{Write-Host " " -NoNewline}
}
}
}
Start-Music
$text = @"
___ __ _ _
|_ _| _ __ / _| ___ _ __ _ __ ___ __ _ | |_ (_) ___ _ __
| | | '_ \ | |_ / _ \ | '__|| '_ ` _ \ / _` || __|| | / _ \ | '_ \
| | | | | || _|| (_) || | | | | | | || (_| || |_ | || (_) || | | |
|___||_| |_||_| \___/ |_| |_| |_| |_| \__,_| \__||_| \___/ |_| |_|
,----------------, ,---------,
,-----------------------, ," ,"|
," ,"| ," ," |
+-----------------------+ | ," ," |
| .-----------------. | | +---------+ |
| | | | | | -==----'| |
| | I LOVE DOS! | | | | | |
| | Bad command or | | |/----|`---= | |
| | C:\>_ | | | ,/|==== ooo | ;
| | | | | // |(((( [33]| ,"
| `-----------------' |," .;'| |(((( | ,"
+-----------------------+ ;; | | |,"
/_)______________(_/ //' | +---------+
___________________________/___ `,
/ oooooooooooooooo .o. oooo /, \,"-----------
/ ==ooooooooooooooo==.o. ooo= // ,`\--{)B ,"
/_==__==========__==_ooo__ooo=_/' /___________,"
`-----------------------------'
###################-:,.......,,,,-:-,,,,,..,,,,,--,,.......,:;##################
##################:-......,--,,.-;+@#######;,,,,,,,,--,......-:#################
################:-......,-,,,,,-#######H##HH#,,,,,,,,,,-,......-:###############
###############:-.....,-,,,,,-:*@H#########HHH,,,,,,,,,,,-,.....,:##############
##############:,....,,,,,,,,:+@@#H######HHH###;,,,,,,,,,,,,-,....,:#############
#############:,....,,...,,,,--+#@*;::-----,:##+,,,,,,,,,,,,,--.....:############
############:.....-.........,:##++++:::::---+#+,,,,,,,,,,,,----.....:###########
###########:,....-.,........,*#@+++;::::----;#+,,,,,,,,,,,,---,-....,:##########
##########:,....,.........,,,*#+*@*@@*-;*+;::#-,,,,--,,.,,,---.,-....,:#########
######### -....-........,,,,.+#+****@@;-+*++:@,,,,,-----,,,---,,,-....-:########
#########:....,,,.....,,,,,,-*+***+*@@;----::*,,,,,-----------,-,-,....:########
########;-....-,,..,,,,,,,,,:*+:@*****+;:-:::+,,,,,,---------------....--#######
########:,...,,,,,,,,,,,,,,..+@;@**@*+;::;::;-,...,,,,------------,,....:#######
########:....-,,,,,,,,,,,.... -@*****+;:-::;-......,,,-----------,.-....-#######
#######:-...,,,,,,,,,,,... ..-@**@####*:;-......,,,,,,-------,,,.,....--######
#######:,...,,,,,,,,,,,,,,,,,..,****+;;:::;.....,,,,,,,,,-----,,,,,,,...,:######
#######:,...-,,,,,,,,,,,,,,....,*****+;:::;;,,.,,,,,,,,,-,,,,,,,,,,,-....:######
#######:....-..,,,,,,,.........,*+**+;::::-#H-............,,,,,,,,..-....:######
#######:....-..,,,,,,.......,:.+;;++++;::;-;##H+:-........,,,,,,--,,-....:######
#######:,...-..,,,,,,...,-;+;:,*;*+++*+;;;.:###H##H@+:-....,,,,,-----....:######
#######:,...,..,,,,,.,,:@####-::**++;@**: .:###;;#######@;,,,,,,----,...,:######
#######:-....,.,,,,-:+#######.:.*+++:@@-. ,-:+H+:###########,,,,,---....-:######
########:....-.,,;*@#########.:.****+;....+;+:,-:;##########H.,,,---....-#######
########:,...,,,-############,,,-;++:,...;#-,:;:,,###########-,...-,....:#######
########+-....-,+#############@+;::;+;++*###;:,,:,@####H#####-,..,-....--#######
#########:,...,,##############H*;- -+++;;*H#@**;,--##########,...,.....:########
######### -....,H#############H@+-.:++;;;+@+-----,,##H#######...,,....-:########
##########:,....:##############@+-.::;;;;*H##+*:,,,#H#######*..,,....,:#########
###########:,....:#############*;-,,::;;+@###@*;:,,#########:..,.....:##########
############:,....-H###########*:;:;;;+*@#H###+:+,,-H#######+,,.....-:##########
#############:,....,@##########@;::;+****@H####;+-,:#HH#####+,.....--###########
##############:,.....:H#########+;++***++*H#######H#H#HH##H:......--############
###############:-.....,+H#######@;+++;:::;@####H###+HHHH#;.......-:#############
################:-,.....,;#####H@:+;:-::;;*H####*#**##*:........-:##############
##################:-.......-+###*;+::;;*#H#######*#+;,.........-:###############
###################+:-........,-:;:;+++++*@H##H#+-,..........,:#################
#####################+:-,...........,,,,,,,,,...............-:##################
"@
Get-Funky $text
#####################################################################################################################
# https://adamtheautomator.com/powershell-pause/#Thread_Sleep
#####################################################################################################################
cmd /C 'echo/ & echo( You can stop and skip the introduction animation and go directly to execute batch commands by typing any key ... & Timeout /T 50>nul'
Stop-Music
Thank you !