Solved Batch file change command color registry value

April 15, 2013 at 21:03:54
Specs: Windows 7 HomePremium 64bit, ...
Here is the part in question of my batch file.

Color 0F
title Color Select
mode con: cols=80 lines=15
echo Customize your Command Prompt Color!
echo 0 = Black 8 = Gray
echo 1 = Blue 9 = Light Blue
echo 2 = Green A = Light Green
echo 3 = Aqua B = Light Aqua
echo 4 = Red C = Light Red
echo 5 = Purple D = Light Purple
echo 6 = Yellow E = Light Yellow
echo 7 = White F = Bright White
echo Enter X to skip!
set /p txtclr= ^ Text Color:
if /i "%txtclr%"=="X" goto :mainmenu
set /p bkg= ^ Background Color:
if /i "%bkg%"=="X" goto :mainmenu
set bkg=%bkg:~0,1%
set txtclr=%txtclr:~0,1%
set bkg=%bkg%
set txtclr=%txtclr%
@COLOR %bkg%%txtclr%

goto mainmenu
echo Make color change system default?
set /p creg= ^ Enter Y or N:
set creg=%creg:~0,1%
if /i "%creg%"=="Y" reg add "HKCU\Software\Microsoft\Command Processor" /t REG_DWORD /v DefaultColor /d %bkg%%txtclr% /f && goto mainmenu
if /i "%creg%"=="N" goto mainmenu
echo.Try Again...

I have the registry section of the code skipped atm.
It adds a value if the two entries are numbers, but for letters, it errors.
Even if it adds the reg key it will not be what it should be.


See More: Batch file change command color registry value

Report •

April 15, 2013 at 23:13:16
✔ Best Answer
I had good results with this mod (from:)
REG_DWORD /v DefaultColor /d %bkg%%txtclr% /f && goto mainmenu

REG_DWORD /v DefaultColor /d 0x%bkg%%txtclr% /f && goto mainmenu

in other words, put "0x" in front of the hex string.
hope this helps.

Report •

April 16, 2013 at 06:39:04
Id indeed did work. Thank you for your help.

Report •

Related Solutions

Ask Question