Page 1 of 1

[solved] cmd window only displays 16 colors with O/S reinstall

Posted: 17 Sep 2023 21:10
by Jer
I have been experiencing issues with my desktop (Win 64 bit) requiring 2 boot-ups because of screen blinking, for
several months, and finally I could not boot at all and repair failed many times. Then I used DELL repair tools
to reinstall Windows and wipe the hard disk of everything.
Now I find that the cmd window is limited to 16 colors. See sample code below. Only 2 colors show up.
The result should be a string of red characters, from darker to lighter.

I've gone through Window Display changes, tried another monitor, installed Acer (monitor) profile, and nothing works.
I specifically opened cmd.exe in \system32 and \sysWOW64 as administrator, with no difference in the 16 color limit.
There are no color issues other than in the cmd window.
The code displays correctly on my laptop.
Has anyone had this limitation and found a solution?

Jerry

Code: Select all

@echo off
setlocal EnableDelayedExpansion
For /F %%a In ('echo prompt $E^| cmd') Do set "ESC=%%a"
set "reset=%ESC%[0m"
set "ch255=Û"
set "r=100" & set "g=6" & set "b=16"
set "string="
For /L %%c In (1 1 40)Do (
  set "string=!string!e[38;2;!r!;!g!;!b!m%ch255%"
  set /A "r+=3"
  If !g! gtr 0 set /A "g-=1"
)
echo !string:e[=%ESC%[!%reset%

Re: cmd window only displays 16 colors with O/S reinstall

Posted: 18 Sep 2023 07:02
by DOSadnie
Maybe it has something to do with these findings viewtopic.php?f=3&t=10878

Re: cmd window only displays 16 colors with O/S reinstall

Posted: 18 Sep 2023 12:21
by ShadowThief
It almost sounds like you installed an older version of Windows that doesn't support VT100 sequences.

Re: cmd window only displays 16 colors with O/S reinstall

Posted: 19 Sep 2023 14:29
by Jer
ShadowThief, thanks for your advice. Windows updated to version 10.0.14393. PC has been rebooted.
I do know how or where to find settings that would display more than 16 colors with RGB sequence codes,
in the cmd window from batch. Display Settings changes made no difference.
Still not resolved.

edit: After checking Windows Update history, I see that 1607 update successfully installed while 20H2 did not.
"ver" command displays the version # above. Its confusing.

I need to get Windows 10 updated with the latest build. The first time I tried it finished with the
message "something went wrong" and an unhelpful error code 0x06d007f.
I will continue to work on this.
:?

Re: cmd window only displays 16 colors with O/S reinstall

Posted: 19 Sep 2023 20:22
by ShadowThief
There's a registry setting you'll have to change because it's not enabled by default: https://superuser.com/a/1300251

Code: Select all

REG ADD HKCU\CONSOLE /f /v VirtualTerminalLevel /t REG_DWORD /d 1

Re: cmd window only displays 16 colors with O/S reinstall

Posted: 20 Sep 2023 18:50
by Jer
More updates finally finished. Turning off firewall and virus scan may have helped.
When I did a successful update, I did not realize that more updating was needed
for "security and features" as warned in Windows Updates screen.

Apparently using sequence codes in batch does not require the registry entry.
Thanks.
:)