How to preserve colored output (stdout and stderr) for cmd scripts from powershell?

前端 未结 2 1384
旧巷少年郎
旧巷少年郎 2021-02-20 04:24

We have build scripts for cmd. For example here is output of one of them.

\"Colored

2条回答
  •  感动是毒
    2021-02-20 04:56

    I'm not positive this will work, but if you don't mind redirecting stderr to stdout, PowerShell won't try to color everything red. To do this, just add 2>&1 when you run your cmd script, e.g.

    build.cmd 2>&1
    

提交回复
热议问题