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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Jer
Posts: 177
Joined: 23 Nov 2014 17:13
Location: California USA

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

#1 Post by Jer » 17 Sep 2023 21:10

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%
Last edited by Jer on 20 Sep 2023 18:51, edited 1 time in total.

DOSadnie
Posts: 143
Joined: 21 Jul 2022 15:12
Location: Coding Kindergarten

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

#2 Post by DOSadnie » 18 Sep 2023 07:02

Maybe it has something to do with these findings viewtopic.php?f=3&t=10878

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

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

#3 Post by ShadowThief » 18 Sep 2023 12:21

It almost sounds like you installed an older version of Windows that doesn't support VT100 sequences.

Jer
Posts: 177
Joined: 23 Nov 2014 17:13
Location: California USA

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

#4 Post by Jer » 19 Sep 2023 14:29

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.
:?

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

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

#5 Post by ShadowThief » 19 Sep 2023 20:22

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

Jer
Posts: 177
Joined: 23 Nov 2014 17:13
Location: California USA

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

#6 Post by Jer » 20 Sep 2023 18:50

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.
:)

Post Reply