Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
585 views
in Technique[技术] by (71.8m points)

msys2 - How to check if my program is running on MinGW(or MSYS) shell, or on CMD?

I use MinGW or MSYS to develop my program, I want to make my program behave slightly differently when running on MinGW(or MSYS) shell than what it does when running on CMD.

This requires the run-time ability to check if my program is running on MinGW(or MSYS) shell, I would like to know if there is any way to do so? Thanks!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can check if the MSYSTEM environment variable is set. If it is you are running under MSYS/MinGW.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...