2

I am running a program which outputs colored text to the Windows command prompt when it runs. Unfortunately, this text is hard to read.

How can I force the output to be black and white? The command in this answer Reset colors on Windows command line (cmd) works well for turning off what the program has already written, but whenever I run it again the colors come back. Basically what I want is to just force my entire session to be B&W.

Stephen
  • 824
  • 4
  • 13
  • 24

1 Answers1

0

The best way to do this is to chain the two commands you are using.

<command> && color 07

That way, once the command is run successfully, it will change the color scheme back to black and white.

Otherwise, if you really want any program you run to be displayed in black and white, you can create a batch file to replay this every second:

:loop
 color 07
 timeout /t 1
 goto loop

from cmd /?:

If /D was NOT specified on the command line, then when CMD.EXE starts, it looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if either or both are present, they are executed first.

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun

and/or

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

You can add your batch file that changes the color to these registry values to have it executed each time cmd.exe runs without the /D modifier.

This way, your terminal will have it's color reset once every time interval, so It'd be easier to read.

NOTE: This method is very inefficient, and might have a few undesirable side effects.

Sources:

Razetime
  • 1,072