The default color of a Command Prompt window is taken from the Registry at HKEY_CURRENT_USER/Software/Microsoft/Command Processor/ under the DefaultColor Key. (as mentioned in How to change the default color of the Command Prompt?) I can query this programmatically as follows:
C:\>reg query "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DefaultColor
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
DefaultColor REG_DWORD 0x2
(I had set it to 02.)
How do I programmatically determine...
the starting color of a command prompt window? (as in
start cmd /T:7ewhich opens a terminal with yellow-on-black; subsequent invocations ofcolorwill restore the colors to the starting color settings)the current color of a command prompt window? (as in
color 2awhich changes the current colors to light-green on green)the "reject" color (??? no idea what this is or where it's stored) that you get when you type
start cmd /T:00which is an "invalid" color setting because in Microsoft's infinite wisdom, it is illegal to have the same foreground and background color, and so you get a different color combination instead, which seems to be the last color combination set interactively from a Command Prompt's Properties -> Color menu, and which seems to be different than the other three colors