Disabling or changing output colors used by the command line (tf.exe)

Avatar

Buck

In the forum, a user asked how to turn off the colors used in the output of the version control command line for Team Foundation (tf.exe).  I thought I’d repost it here.

Question

When tf.exe (beta 3 refresh version) displays an error message the text is colored in yellow on black. My command prompt windows usually have black text on white background. Is it possible to let tf. exe display all output without changing the color, e.g. via an environment variable?

Answer

You can change or turn off the coloring by changing the settings in tf.exe.config (in the same location as tf.exe).

Here is the list of display settings.

Display.FallbackWidth – the width the command line uses when the output is not going to the console; this is used in column calculations, separators and defaults to 80
Display.DisableColors – turns colors on or off (defaults to true)
Display.ErrorBackground – the background of error or warning text (defaults to black)
Display.ErrorForeground – the foreground of error or warning text (defaults to yellow)
Display.InfoBackground – the background of informational text (defaults to black)
Display.InfoForeground – the foreground of informational text (defaults to cyan)

You can turn off coloring altogether by adding the following to your tf.exe.config file.

   <appSettings>
      <add key=”Display.DisableColors” value=”true” />
   </appSettings>

If you simply want to alter the coloring to make it look better, you could use something like the following.  The color choices are black, blue, cyan, darkblue, darkcyan, darkgray, darkgreen, darkmagenta, dark red, darkyellow, gray, green, magenta, red, white, and yellow.

   <appSettings>
      <add key=”Display.ErrorForeground” value=”blue” />
      <add key=”Display.ErrorBackground” value=”white” />
   </appSettings>

Your tf.exe.config file will end up looking something like the following.

<?xml version=”1.0″?>
<configuration>
  <runtime>
    <gcConcurrent enabled=”true” />
    <assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″>
      <publisherPolicy apply=”yes” />
      <probing privatePath=”PrivateAssemblies” />
    </assemblyBinding>
  </runtime>

  <appSettings>
    <add key=”Display.DisableColors” value=”true” />
  </appSettings>

</configuration>

[Update 1/7] Fixed formatting issues.

0 comments

Leave a comment