Skip to content

Instantly share code, notes, and snippets.

@psyrendust
Created August 2, 2014 02:10
Show Gist options
  • Save psyrendust/a3ca1eb640475cd40a99 to your computer and use it in GitHub Desktop.
Save psyrendust/a3ca1eb640475cd40a99 to your computer and use it in GitHub Desktop.
Testing colored output from a windows batch file running in cmd.exe
@echo off
:: Testing color output in a batch script
:: Rendering is slow, but you get pretty colors
call:logblue "-- blue"
call:loggreen "-- green"
call:logcyan "-- cyan"
call:logred "-- red"
call:logmagenta "-- magenta"
call:logyellow "-- yellow"
call:loggray "-- gray"
call:logwhite "-- white"
pause
:logblue
%Windir%\System32\WindowsPowerShell\v1.0\Powershell.exe write-host -foregroundcolor Blue %1
goto:eof
:loggreen
%Windir%\System32\WindowsPowerShell\v1.0\Powershell.exe write-host -foregroundcolor Green %1
goto:eof
:logcyan
%Windir%\System32\WindowsPowerShell\v1.0\Powershell.exe write-host -foregroundcolor Cyan %1
goto:eof
:logred
%Windir%\System32\WindowsPowerShell\v1.0\Powershell.exe write-host -foregroundcolor Red %1
goto:eof
:logmagenta
%Windir%\System32\WindowsPowerShell\v1.0\Powershell.exe write-host -foregroundcolor Magenta %1
goto:eof
:logyellow
%Windir%\System32\WindowsPowerShell\v1.0\Powershell.exe write-host -foregroundcolor Yellow %1
goto:eof
:loggray
%Windir%\System32\WindowsPowerShell\v1.0\Powershell.exe write-host -foregroundcolor Gray %1
goto:eof
:logwhite
%Windir%\System32\WindowsPowerShell\v1.0\Powershell.exe write-host -foregroundcolor White %1
goto:eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment