Reading stdout/stderr output of Windows GUI apps

There are various solutions suggesting program.exe > output.txt or program.exe > output.txt 2>&1 to view stdout/stderr, but this doesn't seem to work for me.

What worked for me is to use Git Bash or Cygwin Terminal to execute the EXE and see the output.

One use case is for GameMaker games that use show_debug_message to output debug text to stdout.