Skip to content

Batch color

Hi,

I'm unable to get colors working when I use Gitlab CI Multi Runner (v0.7.2) on Windows using "cmd" (I didn't try using Powershell). Here is a simple example. It works fine if I execute it on Windows directly but I don't get colours when I use the runner. (The script is in a .bat file that I call in .gitlab-ci.yml)

@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"
)

call :ColorText 0a "blue"
call :ColorText 0C "green"
call :ColorText 0b "red"
echo(
call :ColorText 19 "yellow"
call :ColorText 2F "black"
call :ColorText 4e "white"

goto :eof

:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof

Any ideas ? Is it a know issue ?

Script source : http://stackoverflow.com/questions/29014820/color-echo-in-batch-files

Thank you