Page 1 of 1

color

Posted: 23 Aug 2012 12:45
by ®ᴱᵴᴲᴙᴠᴱᴆ
How can you get the default color value of the command prompt?
Do you have to read a registry key?

Re: color

Posted: 23 Aug 2012 13:59
by abc0502
I guess once you change the color in your cmd from the properities, it will be changed in the registry too.
so you can't get the default values because it's already changed

Re: color

Posted: 23 Aug 2012 14:02
by Ed Dyreen
®ᴱᵴᴲᴙᴠᴱᴆ wrote:How can you get the default color value of the command prompt?
Do you have to read a registry key?
yes

Code: Select all

( %regKey.read_% $var, "HKLM\Software\Microsoft\Command Processor", "DefaultColor" )
( %regKey.read_% $var, "HKCU\Software\Microsoft\Command Processor", "DefaultColor" )

Re: color

Posted: 23 Aug 2012 14:57
by ®ᴱᵴᴲᴙᴠᴱᴆ
Thank you for the responses. When you change the console colors via properties the value still shows up as 0 in the registry. Unless the user has it specified in the registry as 0a, 0b, 0c ..... how do I obtain the hex value of console color not just 0 for default. Where is this data located?

Thanks

Re: color

Posted: 24 Aug 2012 01:24
by trebor68
I think that the change of properties can find with the following XP command:

Code: Select all

reg query "HKU\.DEFAULT\Console" /v "ScreenColors"

The standard of ScreenColor value is hex07.
background color = 0 = black
text color = 7 = light gray

To reset to standard value in the CMD window:
COLOR
or
COLOR 7
or
COLOR 07

Re: color

Posted: 24 Aug 2012 15:15
by trebor68
If you run the CMD command with short cut "Win + R" can you use the option "/t" to select the colors.

Without the option "/t" is used the color that is definated in "DefaultColor".

If the value in "DefaultColor" one of the following hex value: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
then is used the "ScreenColors". (background color and text color the same color)

When you use one of the values in COLOR then will not change the color and the ERRORLEVEL 1.

The standard value are:

"HKLM\Software\Microsoft\Command Processor"
DefaultColor=0x00000000 (0)

"HKU\.DEFAULT\Console"
ScreenColors=0x00000007 (7)

###

If you start the CMD command over a link (icon) and you change the properties than will save this possible in the link file.

Re: color

Posted: 26 Aug 2012 18:52
by Dos_Probie
This is what works for me for text color from .reg file...


Code: Select all

;**Customize your dos text color, default is 0 (white) change text to green with the black standard background**
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"DefaultColor"=dword:0000000a