windows cmd and vt-seq

Now, that i have started exploring rust and wrote a few tools. I wanted to use vt-sequences to dump better text (color and other good stuff). Howver old cmd just does not cope with it.
One such example is when listing all files in directory recursively (inspired from this excellent utility: ff)

C:\Users\sarangb\source\rust\listfiles>target\debug\listfiles.exe rs$
.\src\app. [1;32mrs [0m
.\src\args. [1;32mrs [0m
.\src\main. [1;32mrs [0m
.\src\path_printer. [1;32mrs [0m
.\src\walker. [1;32mrs [0m


This behaves just fine when I use terminal instead. Searching online a bit, found a few ways to tackle these:

So went with second option:

  • start regedit in admin mode
  • added a key to HKCU\Console
    • VirtualTerminalLevel as DWORD with value 1


Restarted cmd and that is it. Now the output looks much better:

C:\Users\sarangb\source\rust\listfiles>target\debug\listfiles.exe rs$
.\src\app.rs
.\src\args.rs
.\src\main.rs
.\src\path_printer.rs
.\src\walker.rs