Visual Studio Developer Center > Visual Studio Forums > Visual Studio Extensibility > How to check out all the environment variables in visual studio
Ask a questionAsk a question
 

AnswerHow to check out all the environment variables in visual studio

  • Wednesday, June 24, 2009 6:03 PMPatrick.Djo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    If I start the visual studio by devenv /useenv, visual studio will take in all the environment variables already set in the cmd shell. And there are tons of other ways to set environment variables in visual studio. What if after that, I want to check the value of a specific environment variable or all of them just I would do in a cmd shell by typing "set" or "set *". For example, if I do set FrameworkSDKDir in a visual studio command prompt, it will show the directory value.  How may I do the similar thing in visual studio since some environment variables are only valid inside visual studio but not the cmd shell from which it is opened.

    Thanks
    Patrick

    • Moved byFigo FeiMSFTFriday, June 26, 2009 3:36 AM (From:Visual Studio Setup and Installation)
    •  

Answers

All Replies

  • Friday, June 26, 2009 7:24 AMRong-Chun ZhangMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hello Patrick,

    Do you mean check the environment variables for devenv process when starting with /UseEnv?

    We can use Process Explorer to read environment variables for each running process. Doulbe click the process, and select the Environment in the pop-up dialog, the environment variables will show.

    http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

    Thanks,
    Rong-Chun Zhang
    Please mark the replies as answers if they help and unmark if they don't.
    Welcome to the All-In-One Code Framework, a sample code project owned by the MSDN Forum Support team!
  • Wednesday, July 15, 2009 9:07 PMPatrick.Djo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Wonderful.  Was looking for an option in VS2003 to print all the environment variables to the build log, which I haven't yet found in vs2008. Anyway, this works better. Thanks -Patrick
  • Monday, August 03, 2009 7:28 PMMarkDuckworth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    To print to the build log:

    vc++
    In the project property pages select the tab Configuration Properties > Build Events > Post-Build Event and add the command "set" to the Command Line text box.

    c#
    In the project properties, select tab Build Events and add the command "set" to the Post-build event command line text box.
  • Tuesday, August 04, 2009 10:31 AMRong-Chun ZhangMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Good idea! Thanks for your sharing, Mark.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Tuesday, November 03, 2009 5:12 PMmmw109 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hower what about "special" variables used within VS.  E.g. I cannot see "IntDir" or "ProjectDir" inside the Environment, but I can use these inside my Project Properties.  I would I get a listing of these, and what they are set to ?