views:

247

answers:

1

I have a build process using MSVC 2005. It only works correctly if run from a Visual Studio command prompt, not from a regular command prompt, because of the additional variables that get set. It's far too easy to run the wrong type of prompt and then get obscure error messages, so I'm trying to avoid this. I don't want to change my regular command prompt to always call vsvars32.bat, since I don't always want this, but I wanted to add a message to suggest using the Visual Studio Command Prompt. To do this, I wrote a BAT file

if "%VSINSTALLDIR%" == "" echo Did you want a Visual Studio Command Prompt?

However, this also shows up in the Visual Studio Command Prompt because it gets called before vsvars32.bat does.

Does any one have any idea how I could get a message added to a normal command prompt but not the Visual Studio 2005 Command Prompt? I suspect from how the Visual Studio Command Prompt is set up this isn't possible.

Thanks.

+1  A: 

Why not execute vsvars32.bat from within your build process? The other option is to explicitly spawn a shell using something like cmd.exe /k path-to-vs\vsvars.bat - IIRC, the /k option makes the shell execute the argument and remain open.

D.Shawley