Skip to content

Commit

Permalink
[windows] fix: support ANSI color
Browse files Browse the repository at this point in the history
  • Loading branch information
ifTNT committed Jul 4, 2024
1 parent a296115 commit 29e5570
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions windows/src/tee.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ exit /b
function stripAnsi(str) {
return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
}

// Launch a powershell to enable ANSI color support
// Reference: https://www.dostips.com/forum/viewtopic.php?p=59696#p59696
var ps = WScript.CreateObject("WScript.Shell").Exec("powershell.exe -nop -ep Bypass -c \"exit\"");
while (ps.Status == 0) WScript.Sleep(50);

var fso = new ActiveXObject("Scripting.FileSystemObject");
var mode=2;
if (WScript.Arguments.Count()==2) {mode=8;}
Expand Down

0 comments on commit 29e5570

Please sign in to comment.