Rotate CMD.exe Colors

Call this function to rotate through different CMD.exe color schemes on Windows. Modify the COLOR_LIST variable as you like (see COLOR /? for details).

:SetColor
if NOT DEFINED COLOR_LIST set COLOR_LIST=0A0B0E
setlocal

set CAR=%COLOR_LIST:~0,2%
set CDR=%COLOR_LIST:~-4%

color %CAR%

REM rotate w/ export hack
for %%D IN (1) DO (
   endlocal
   set COLOR_LIST=%CDR%%CAR%
)

exit /B

Update:
It might be desirable to change the line set COLOR_LIST=%CDR%%CAR% to instead use the setx command like this:

setx COLOR_LIST %CDR%%CAR%

This sets a global environment variable instead of a local one which merely applies to the current CMD window and descendants.

Advertisements


%d bloggers like this: