59

I have three different versions of Visual Studio installed on my machine, Visual Studio 2003, Visual Studio 2008, and VS2005.

How do I start a particular version of Visual Studio using a command prompt?

devenv.exe opens the latest version of Visual Studio. What should I do if I want to open Visual Studio 2003 using a command prompt?

SNA
  • 7,528
  • 12
  • 44
  • 60

18 Answers18

65

Haven't tested on preceding versions - but to launch Visual Studio 2019 you can just enter start devenv to launch right away without entering into a path

KoalaZub
  • 1,087
  • 8
  • 10
  • 7
    This is incredibly useful. – Kit Mar 03 '20 at 15:47
  • 6
    Thanks a lot. An extra thing, if you wanna start a certain solution and navigate to the folder, you can type "start devenv *sln" and then press tab and it should find the solution file locally there (.sln) – Holger Nov 23 '20 at 13:12
  • 5
    It should be noted that this only works reliably if you have only installed a single version of Visual Studio. If you have installed more than one version (as many of us do) then you get the last version that you installed (or the first, I forget which). If you want to control which version you run, then you need to use the path at some point. – RBarryYoung Nov 24 '20 at 16:53
  • 5
    To run a different version just edit registry path in `Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\devenv.exe`. – Laurynas Lazauskas Dec 24 '20 at 13:54
  • 4
    Thanks for this. Exactly what i was searching for. I noticed that I could open the solution in the current folder using start devenv . (note the period) Hope that helps someone! – Robert White May 28 '21 at 08:48
  • 1
    Very useful. And to add to the start 'devenv *.sln' option mentioned above, you can also do the same with 'start devenv *.csproj', or open a directory in folder view by using 'start devenv .' - note the dot at the end. – dmcquiggin Feb 23 '22 at 09:45
39

You have to use the path to distinguish them. For instance, here is the Visual Studio 2005 command on my laptop:

    "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe"

Here's another tip: You can figure out how to run various Windows applications from the command line by finding them in the Windows Start Menu, right-clicking on the icon, select properties, and then on the Shortcut tab, look at the Target textbox. Copy that text out and usually you can use it at a console command line.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
RBarryYoung
  • 55,398
  • 14
  • 96
  • 137
  • 3
    Visual Studio 2017, Enterprise Version: `"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.com"` – Stefnotch Jan 10 '19 at 17:03
10

This answer is a different way to handle starting Visual Studio in any version of Windows, by using the Windows Key {windows logo} start to start the target application.

  1. Pin each version to the task bar. One way is to right click an active running program and select 'Pin to Taskbar. Or find in the program manager and right click again to pin.

  2. Pin each different version right next to the task bar. For this example pin each version in succession 2003, 2005 and finally 2008. Make sure they are next to the start button for easier index number memorization.

    enter image description here

  3. To launch the 2003 version hit the WindowsKey then number 1.

  4. To launch 2005 WindowsKey 2.

  5. To launch 2008 WindowsKey 3.

This is fast and easy and can launch multiple instances without bringing up the command console.

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
  • 1
    +1 for introducing me to this shortcut. It should be noted though that this will either launch the application *or* switch to the application, it if is already running. Therefore, you cannot use this as a general purpose solution for "starting a particular version". *However*, if you already have an instance of the version of VS running, and you want to open another one, you could use `WindowsKey + Alt` to bring up the launch menu, and then use the arrow keys to select and launch a new instance. – Eric Lease Apr 25 '16 at 15:11
5

For Visual Studio on a mac, you can:

open '/Applications/Visual Studio.app' [path_to].sln

I create an alias in my bash_profile so I can just navigate to a directory and open it in VS:

echo "alias vs=\"open '/Applications/Visual Studio.app' *.sln\"" >> ~/.bash_profile

andes
  • 514
  • 3
  • 6
5

Use devenv.exe for the specific version of Visual Studio. There will be one located in the Common7\IDE folder of the install. Here are the directories as I remember for the various versions.

  • 2008:

    %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\Ide\devenv.exe
    
  • 2005:

    %ProgramFiles%\Microsoft visual Studio 8\Common7\Ide\devenv.exe
    
JaredPar
  • 733,204
  • 149
  • 1,241
  • 1,454
4

Here is the shortcut, You can just type devenv.exe and start visual studio Here is the shortcut, You can just type devenv.exe and start visual studio

4
  • Put C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ in the path of your computer.
  • Then open a new command prompt.
  • Change the directory to your project folder.
  • Type devenv to open the project in Visual Studio from the command prompt. This opens the project up in folder view. It has to have a .sln file to do the next part.
  • Click the switch views drop-down arrow and choose the .sln file.

The solution explorer will now display the solution.

3

You can also use the "Visual Studio 2005 Command Prompt" and "Visual Studio 2008 Command Prompt" to load a version-specific command shell environment, and then run devenv. This is typically found under Start -> Programs -> Visual Studio -> Visual Studio Tools

If you can't or don't want to access it via the Start menu, you can also "load" the VS-version specific environment in a normal command shell using the following (for VS 2008, with a default install path): (note: change x86 as appropriate for your platform)

(32 bit) %comspec% /k ""C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"" x86

(64 bit) %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat"" x86

or for VS 2008 (with default install path):

(32 bit) %comspec% /k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86

(64 bit) %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86

Each sets the environment so if you then subsequently execute devenv it'll load the correct version.

RobS
  • 9,382
  • 3
  • 35
  • 63
1

1) devenv (to open VS)

2) devenv *.sln (then tab to autocomplete and enter to open VS and auto-load current solution)

By default, this only works in Developer Command Prompt. To make it work in a normal console (I use cmder) you need to add folder path to devenv.exe to the System environment variable name Path. For me that is this one:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE

You can also use this script and save it as vs.bat and then it will find for you *.sln file in the folder and automatically open visual studio with solution loaded (as in 2.)

pajics
  • 2,938
  • 3
  • 23
  • 27
1

Similar question where I answered: Visual studio: How to open a specific solution directly from command line?

Essentially use OpenVSSolution

  • Put this helper exe somewhere in your PATH
  • The exe scans the current directory for a .sln file
  • The exe opens devenv passing in the sln file

The explanation is on here: https://davemateer.com/coding/2018/11/14/Publish-dot-net-core-console-application.html

I find this incredibly useful and is how I open all solutions.

Dave Mateer
  • 6,588
  • 15
  • 76
  • 125
1

Use Window Terminal (https://github.com/microsoft/terminal), run these commands in the terminal

 cd your-project-folder
.\your-solution.sln
Ha Doan
  • 611
  • 6
  • 20
1

Use an abolute path, for example, C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
  • In Vista OS Type this command "devenv" in start search and give enter. it will open the current version of VS sdk. – Jeyavel Jul 16 '10 at 07:24
0

I tried the answer that has been accepted in this question but it didnt work for me

I was able to launch Visual studio from RUN by typing devenv.exe in it.

WIN+R didnt work for opening RUN, so in command prompt, I typed the below path in command prompt

c:\WINDOWS\system32\rundll32.exe shell32.dll`,#61
Vignesh Subramanian
  • 7,161
  • 14
  • 87
  • 150
0

use this command:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe
mslot
  • 4,959
  • 9
  • 44
  • 76
Hasan A Yousef
  • 22,789
  • 24
  • 132
  • 203
0

You can create a bat script for any visual studio version. You can find my script below.

start /B "" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe"

Even, you can create an alias following this post

Gokce Demir
  • 459
  • 4
  • 5
0

cmd + R devenv still opens VSCode 2022

warkitty
  • 106
  • 3
  • 5
-1

To open it with Visual Studio Express 2012 for Windows Desktop do -

%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat""

%comspec% is:

C:\Users\Admin>echo %comspec%
C:\Windows\system32\cmd.exe

Or just search "developer" in the Windows 8 Start Search "Apps" menu, and it will lead you to "Developer Command Prompt for VS2012".

kungfooman
  • 4,473
  • 1
  • 44
  • 33
-1

Go to your project directory in cmd. (ex. cd <=FOLDER_PATH=>)

type code and press enter.