How to get the path to the VS command line prompt (in both 32bit and 64bit)?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: How to get the path to the VS command line prompt (in both 32bit and 64bit)?

  1. #1
    Join Date
    Apr 2009
    Posts
    73

    Question How to get the path to the VS command line prompt (in both 32bit and 64bit)?

    Hi,

    Up until today, in order to get the VS command line prompt I checked the "ProductDir" value in the "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\VC" registry key.

    I noticed that this code won't necessarily do the job if I'm running on Windows 7 64 bit, since this key is not always accissible to all programs.

    I started to read a little about "WOW64", registry redirection, and registry reflection, but to verify that I'm not doing some kludgy Quick & Dirty work I wanted to ask: Is there a C# code to get the full path to the VS command-line prompt which is not dependent on the Windows version (XP, Vista, Server, or Windows 7), and not depend on whether we're in 32bit or 64bit?

    Thanks at Advanced

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,990

    Re: How to get the path to the VS command line prompt (in both 32bit and 64bit)?

    The CMD prompt will not be what you expect, as it is not the logged on user running your program on Vista+ Really depends on what you need to do with the info?

    The ENVIRON variables might help
    Last edited by dglienna; October 24th, 2010 at 09:53 PM.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2009
    Posts
    73

    Question Re: How to get the path to the VS command line prompt (in both 32bit and 64bit)?

    Hi dglienna,

    I didn't understand your reply, can you write in more details and explain what you mean?

    Regards

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,990

    Re: How to get the path to the VS command line prompt (in both 32bit and 64bit)?

    You should have something like this:
    Code:
    ALLUSERSPROFILE=C:\Documents and Settings\All Users
    APPDATA=C:\Documents and Settings\David\Application Data
    CLASSPATH=C:\Program Files\Java\jre1.5.0_04\lib\ext\QTJava.zip
    CommonProgramFiles=C:\Program Files\Common Files
    COMPUTERNAME=Laptop.
    ComSpec=C:\WINDOWS\system32\cmd.exe
    FP_NO_HOST_CHECK=NO
    HOMEDRIVE=C:
    HOMEPATH=\Documents and Settings\David
    INCLUDE=G:\Program Files\Microsoft.NET\FrameworkSDK\include\;C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\;G:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\;D:\Program Files\Microsoft Visual Studio\VC98\atl\include;D:\Program Files\Microsoft Visual Studio\VC98\mfc\include
    LIB=C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\;G:\Program Files\Microsoft.NET\FrameworkSDK\Lib\;G:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\;D:\Program Files\Microsoft Visual Studio\VC98\mfc\lib
    LOGONSERVER=\\Laptop.
    NetSamplePath=G:\PROGRA~1\MICROS~1.NET\SDK\v1.1\
    NUMBER_OF_PROCESSORS=1
    OS=Windows_NT
    Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;G:\Program Files\Microsoft.NET\FrameworkSDK\Bin\;C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE\;C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\;C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;D:\Program Files\QuickTime\QTSystem\;D:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;D:\Program Files\Microsoft Visual Studio\Common\Tools;D:\Program Files\Microsoft Visual Studio\VC98\bin
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    PROCESSOR_ARCHITECTURE=x86
    PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 7, GenuineIntel
    PROCESSOR_LEVEL=15
    PROCESSOR_REVISION=0207
    ProgramFiles=C:\Program Files
    QTJAVA=C:\Program Files\Java\jre1.5.0_04\lib\ext\QTJava.zip
    SESSIONNAME=Console
    SystemDrive=C:
    SystemRoot=C:\WINDOWS
    TEMP=C:\DOCUME~1\David\LOCALS~1\Temp
    TMP=C:\DOCUME~1\David\LOCALS~1\Temp
    USERDOMAIN=Laptop.
    USERNAME=David
    USERPROFILE=C:\Documents and Settings\David
    VS71COMNTOOLS=G:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\
    windir=C:\WINDOWS
    from 2 years ago, before VS2008, I think.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Apr 2009
    Posts
    73

    Question Re: How to get the path to the VS command line prompt (in both 32bit and 64bit)?

    Sorry, but I didn't understand how this answer my question:

    How to programmatically get the path to the Visual Studoi command line prompt - a C# code which will work for .NET programs compiled with "Any CPU" platform, and that will run on both 32bit and 64bit?

    Regards

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,383

    Re: How to get the path to the VS command line prompt (in both 32bit and 64bit)?

    Quote Originally Posted by Trinominal View Post
    Sorry, but I didn't understand how this answer my question:

    How to programmatically get the path to the Visual Studoi command line prompt - a C# code which will work for .NET programs compiled with "Any CPU" platform, and that will run on both 32bit and 64bit?

    Regards
    If you let us know why you need this path, we might be able to help further.

  7. #7
    Join Date
    Apr 2009
    Posts
    73

    Question Re: How to get the path to the VS command line prompt (in both 32bit and 64bit)?

    I need it in order to prorammatically launch the Visual Studio command line prompt.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center