如何保护来自powershell的cmd脚本的彩色输出(stdout和stderr)? [英] How to preserve colored output (stdout and stderr) for cmd scripts from powershell?
本文介绍了如何保护来自powershell的cmd脚本的彩色输出(stdout和stderr)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们有cmd的构建脚本。例如这里是其中一个的输出。
当我在PS中运行相同的命令输出一切红色(可能是因为它的错误输出)。
$ b $
解决方案
首先,我不认为这是可能的。
但是,经过一番搜索后,我发现了这篇博客文章, HTML和RTF中控制台屏幕的彩色捕获。
您应该可以使用PowerShell脚本来创建您需要的脚本。
We have build scripts for cmd. For example here is output of one of them.
When I run same commands in PS it outputs everything in red (probably because it's for err output).
Can I keep colors somehow?
解决方案
At first, I didn't think it was possible.
But, after a little searching I found this blog post, Colorized capture of console screen in HTML and RTF.
You should be able to use the PowerShell script from there to create what you need.
这篇关于如何保护来自powershell的cmd脚本的彩色输出(stdout和stderr)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文