Coloring Batch Files! – within one file!

I wanted colored batch files and I managed to achieve this with someones solution which I modified and made my own, it is now quite different to his but I cannot find who it was to give them credit, anyway, here is the code!

 

@echo off
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
title Startup Assist - Handler
call :ColorText 08 "["
call :ColorText 08 "Service"
call :ColorText 08 "]"
call :ColorText 08 " Startup Assist - HANDLER - RUNNING "
echo.
call :ColorText 08 "["
call :ColorText 0E "WARNING"
call :ColorText 08 "]"
call :ColorText 08 " Startup Assist will stop if a server startup file is not found this is because of windows MS DOS functionality, Sorry "
echo.
call :ColorText 08 "["
call :ColorText 08 "Minecraft Service"
call :ColorText 08 "]"
call :ColorText 0A " Minecraft Server "
call :ColorText 0C " Nexion"
call :ColorText 0A " Started"
echo.
start "launch.bat" "C:UsersNexionDocumentsMinecraft ServersNexionlaunch.bat"
echo(
call :ColorText 79 "This window will now await user input!"
echo.
)
PAUSE
exit
goto :eof

:ColorText
echo off
“%~2”
findstr /v /a:%1 /R “^$” “%~2” nul
del “%~2” > nul 2>&1
goto :eof

which looks something like this

Capture

As you can tell, this is for my minecraft server 🙂 (Nexion.co.uk)

and that’s all there is to it! you can use any standard colors that you could already within batch files. (Note: When running without user, i.e. started by another process, the colors requite administrative privileges!)

edit: http://stackoverflow.com/questions/7290434/how-can-i-make-a-multi-functional-batch-program