Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert colored output of a console application (like MSBuild or PowerShell) into HTML format preserving colors?

When I run certain console applications (particularly, MSBuild or PowerShell) they produce an output containing text of different colors (for warnings, errors etc). Sometimes I need to save it for a future analysis, or to send it in an e-mail. I only can copy plain text from the console, or redirect the program output to a file, but this way all colors are lost. Is there a way to capture an output of a console application in a color-preserving format like HTML or RTF?

like image 458
Vladimir Reshetnikov Avatar asked Apr 30 '13 19:04

Vladimir Reshetnikov


1 Answers

Powershell team blogged this script, which captures console screen buffer up to the current cursor position and returns it in HTML format.

like image 177
Vladimir Avatar answered Nov 14 '22 20:11

Vladimir