Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if the terminal is a windows terminal

How to determine if the terminal is a windows terminal.

I want to enabled ANSI output in windows terminal and disenabled in CMD.

Is it possible to judge through environmental variables? like:

  • ANSICON in https://github.com/adoxa/ansicon
  • ConEmuANSI in https://conemu.github.io/en/ConEmuEnvironment.html

What is the best practice?

like image 727
candycat Avatar asked Oct 17 '25 06:10

candycat


1 Answers

You can check if the environment variables WT_PROFILE_ID or WT_SESSION are present.

like image 128
Markus Gans Avatar answered Oct 18 '25 22:10

Markus Gans



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!