mingwmsys2msys

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!


Solution

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