-
October 24th, 2010, 08:00 PM
#1
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
-
October 24th, 2010, 09:49 PM
#2
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.
-
October 25th, 2010, 08:20 AM
#3
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
-
October 25th, 2010, 10:29 AM
#4
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.
-
October 25th, 2010, 04:32 PM
#5
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
-
October 25th, 2010, 06:42 PM
#6
Re: How to get the path to the VS command line prompt (in both 32bit and 64bit)?
Originally Posted by Trinominal
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.
-
October 25th, 2010, 06:54 PM
#7
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|