views:

415

answers:

4

How can I use the tools included in the VS command prompt (Programs | MS Visual Studio 2008 | Visual Studio Tools | Visual Studio 2008 Command Prompt) from any command prompt (ie without calling vcvarsall.bat) or program?

A: 

Perhaps add to your path var the locations of bin folders for the tools provided by visual studio

JC
A: 

To get it to work from a program, the easiest route is probably to set all the environment variables permanently for the user.

To use it from a command prompt... I just use the Command Prompt Tools shortcut as my normal command prompt shortcut, so I've always got them anyway. The good thing about this approach is that you can have different shortcuts for different versions - so I have a VS2008 shortcut and a VS2010 shortcut.

Jon Skeet
A: 

You might be interested in adding a "Visual Studio Command Prompt Here" context menu option in Windows Explorer. Scott Hanselman has a link to an .inf file you can run to make the registry changes for this

Russ Cam
+2  A: 

The easiest way to do this is to add the PATH, INCLUDE, LIB and LIBPATH environment variables that are listed in the vsvarsXX.bat file for VS2005 on a 32 bit Intel box.

Here's the sample for vsvars32.bat:

@SET VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8
@SET VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8\VC
@SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
@SET FrameworkVersion=v2.0.50727
@SET FrameworkSDKDir=C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0
@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR

@echo Setting environment for using Microsoft Visual Studio 2005 x86 tools.

@rem
@rem Root of Visual Studio IDE installed files.
@rem
@set DevEnvDir=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE

@set PATH=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\bin;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\bin;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;%PATH%
@set INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE;C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\include;%INCLUDE%
@set LIB=C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\LIB;C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;%LIB%
@set LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\LIB

@goto end

:error_no_VSINSTALLDIR
@echo ERROR: VSINSTALLDIR variable is not set. 
@goto end

:error_no_VCINSTALLDIR
@echo ERROR: VCINSTALLDIR variable is not set. 
@goto end

:end

Pick and fill in the values from there.

Pete OHanlon
That's exactly what I was looking for.
Zenith