My colleague Kang Su (that's his first name) came by my office yesterday to borrow a book. You might think a story that starts like this couldn't possibly lead to anything interesting. This tale is compelling though so hang tight. So the book in question was Debugging Applications for Microsoft .NET and Microsoft Windows (what a mouthful!). It's supposedly a classic and Kang Su could not find his copy. As we were chatting, he decided to bring up the issue for which he wanted to borrow the book in the first place. Kang Su, being the most technical PM to grace the halls of Visual C++, wanted to debug Phoenix (the next generation compiler) using Visual Studio. The problem lies in the fact that he does not have a solution and the executable relies on a bunch of environment variables. He asked me for a way to launch the app, in the debugger, with the environment set, all in one fell swoop. Instead of letting him leaf through the 800+ pages of the tome he was taking, I decided to take a look at the command-line switches for devenv.exe. Lo and behold, the answer was simple.

> set ENV_VARIABLE=value

> devenv /useenv /debugexe myapp.exe [ <myapp arguments> ]


That's all folks!