" 'devenv' is not recognized as an internal or external command ..."
Asked Answered
F

6

15

Is there a way to just open a VS project from the command prompt? For example, the way with Atom, you can navigate to the folder you'd like to open and just run "atom ." Does that kind of utility exist for VS?

edit: Would the equivalent to this be "C:\> devenv /run SomeSolution.sln" ?

if so, great! But there still seems to be a problem because I think the "devenv" command should at least be recognized, but I currently get

'devenv' is not recognized as an internal or external command, operable program or batch file.

I saw that a S/O contributer recommended adding

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe

to the PATH environment variables values like this, per MSDN, which I did, but I get the same message.

Can anyone explain what might be going on and how to fix it? Thanks

Feminism answered 1/6, 2016 at 21:59 Comment(1)
Use the Start menu to launch the Visual Studio command prompt (whatever version of VS you're using), in some versions called the Developer Command Window. From that prompt, devenv should work. You can't add an executable to the PATH; you can add the folder that executable is located, though. Nothing in the question (including answers or comments) recommending adding what you said to the PATH, however.Calfskin
E
38

You need to add new path to existing Path value.

Complete solution:

  1. Go to MyComputer >> Properties >> Change Settings >> Advanced >> Environmental variables

  2. Click on Path value on bottom pane, and then click Edit.

  3. Add new path to your devenv.exe folder location. For me this is "D:\Program Files\Microsoft Visual Studio Community 2022\Common7\IDE\"

EDIT: Updated path to Visual Studio 2022

Ellord answered 14/3, 2018 at 20:14 Comment(4)
for me, the path is C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDEKennith
C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Orderly
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDEScudder
it is now C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDESiqueiros
O
5

On similar issue, for VS 2017, I wanted to build a solution, below worked fine:

call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe" Project.sln /build
Obverse answered 13/11, 2018 at 8:36 Comment(0)
H
4

This is much easier than it looks. Go to the root directory for the project, type the name of the .sln file, and hit Enter. Windows knows how to use the registry o find devenv.exe based on the extension of the file you run.

For example:

cd \Projects\SampleApp
SampleApp.sln

This technique is the same as if you opened the sln file by double clicking it in Explorer.

Hydrolyse answered 4/6, 2016 at 20:43 Comment(1)
how to run this as wellLarson
R
1

VS 2019 Community

 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe

Any Visual Studio Version

To find your specific devenv.exe path regardless of VS copy/version you can use cmd and then run:

cd \

dir /s divenv.exe

Note: The command dir /s may take a few minutes to find it.

Rankins answered 12/8, 2020 at 4:10 Comment(0)
D
1

Since I had no desire to update my PATH variable, I used the following steps to run devenv on the command prompt:

  1. Navigate to the Visual Studio shortcut on the Start menu
  2. Right-click the shortcut
  3. Click on properties
  4. Copy the path displayed in Target. This is the path to whatever version of devenv that you use.
  5. Paste the copied path into the command prompt and press enter
Datha answered 24/8, 2020 at 17:42 Comment(0)
N
0

Mine is a windows machine, and for this command to work, devenv must be added to the path environment variable.

First ensure you have visual studio is installed on your machine.

On my machine, the devenv exe is available at the following location.

C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE

Next add this to the path environment variable.

Open System Properties

Windws System Properties

Path Env Variable

Do not forget to close your command prompt and then start it again. This will enable the env vars to load into the command prompt.

Nectarine answered 22/4, 2023 at 3:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.