Visual Studio Command Prompt vs. a regular command prompt?
Asked Answered
H

6

36

When I open a Visual Studio command prompt (for example, opened with menu Start -> Programs -> Microsoft Visual Studio 2008 -> Visual Studio Tools -> Visual Studio 2008 Command Prompt), I get:

Setting environment for using Microsoft Visual Studio 2008 x86 tools.

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE>

What kind of tools are available, and what are the most common uses of this command prompt?

Hexahedron answered 14/7, 2009 at 13:51 Comment(0)
E
30

It basically just sets several of the Visual Studio binary locations into the PATH environment variable for that command window instance. This means you can use all the various commands and tools without having to include the full paths.

There's a partial list of some of the tools available on MSDN in .NET Framework Tools and Tools (.NET Framework).

Emptor answered 14/7, 2009 at 13:59 Comment(0)
F
11

The Visual Studio command prompt is a convenient way to access the command line tools that ship with the .NET Framework SDK and, if installed the, Windows Platform SDK tools.

By providing the Visual Studio command prompt, Microsoft allows you to run these tools without requiring your PATH, INCLUDE, LIB and LIBPATH environment variables to contain all the additional paths to the various folders where Visual Studio and the .NET SDK are installed. Instead, these folder references are added on the fly when you start the Visual Studio command prompt allowing you to run the tools.

For example, if you open a regular command prompt you cannot run xsd.exe without changing to the directory "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin". However, in the Visual Studio command prompt you can just type xsd.exe /?, and it works.

Please see the MSDN article .NET Framework Tools for a complete list of the tools provided with Visual Studio 2008 SP1 and details on what they do.

Flutist answered 14/7, 2009 at 14:17 Comment(0)
T
1

The Visual Studio command prompt has a few tools with it. Some tools are for repairing the install of Visual Studio. One of the tools I love using is for WCF. You type wcftestclient and you get a client to test your WCF services.

Tousle answered 14/7, 2009 at 13:55 Comment(1)
+1 for that! I am about to start a project using a WCF service!Hexahedron
T
1

The article The Visual Studio Command Prompt has a nice explanation:

Let's look at the "Visual Studio Command Prompt" in more detail.

It appears to just set the path for you and put you in (Ta Da!) the VC directory under Visual Studio. Not even the C# directory and certainly not the VB directory. I guess they assume that anyone who uses this tool is really hard core and programs directly against the hard drive with a magnifying glass and a magnet.

What it actually does is run this DOS command. (In my case.)

%comspec% /k ""C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86

What does vcvarsall.bat do? Well, it sets the target compiler environment so you can compile code for a different processor.

Tulipwood answered 13/10, 2010 at 21:11 Comment(0)
H
0

One use seems to be to call the XML Class Generator for using XSD schemas for serialization/deserialization:

XML Class Generator for C# using XSD for deserialization

Hexahedron answered 14/7, 2009 at 13:52 Comment(1)
xsd.exe is a slick tool, but it's not limited to the VS Command Prompt. As Simon mentions the VS Command prompt just sets the Path environment variable to include locations of VS tools... so you can just type "xsd.exe" instead of (something like) "c:\program files\microsfot visual studio 8.0\tools\bin\xsd.exe"Sigmatism
D
0

Simple example

After installing Desktop development with C++ as part of the VS Installer, it installs C++ CMake tools for Windows. Let's run this cmake.exe file!

VS Developer Command Prompt

C:\Directory>cmake --version
cmake version 3.21.21080301-MSVC_2

Windows Command Prompt

C:\Directory>cmake --version
'cmake' is not recognized as an internal or external command,
operable program or batch file.

Why example behaves as it does

The VS Developer Command Prompt knew the command cmake, yet the Windows command prompt didn't.

Its almost as if it is and isnt a path variable - Schrodingers cat, errr path!

So where is cmake.exe that the VS developer command prompt says it knows about?

VS Developer Command Prompt

C:\Directory>where cmake
C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe

Okay so that means C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\ must be a PATH variable.

Lets double check:

C:\Directory>set PATH
Path=C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;

It is, great. Now why didnt the windows command prompt find it?

Windows Command Prompt

C:\Directory>set PATH

Hmmm, I'm looking at the list and its not there.

Now Simon Steven's and MikeD's answer can be put in context:

It basically just sets several of the Visual Studio binary locations into the PATH environment variable for that command window instance. This means you can use all the various commands and tools without having to include the full paths.

Discount answered 14/8, 2022 at 12:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.