Freigeben über


Did you know… You can use devenv.exe /edit to open a file in an existing Visual Studio instance - #360

Visual Studio has a command line argument you can specify to open a file in an existing instance of VS.

command line example

Just run devenv /edit <filename> and the file will open in the IDE.

file opened in Visual Studio alongside other files

You could also create a VSEdit command if you find yourself using this feature a lot.  Just create a file called "VSEdit.cmd" (you can use notepad to do this) with the following:

@"devenv.exe" /edit %*

provided you already have %Program Files%\Microsoft Visual Studio 9.0\Common7\IDE added to your system PATH environment variable. And, of course, you might want to place this VSEdit.cmd in a directory that’s in your PATH or add it.

another command line example

Technorati Tags: VS2005Tip,VS2008Tip

Comments

  • Anonymous
    November 18, 2008
    PingBack from http://blog.a-foton.ru/index.php/2008/11/19/did-you-know%e2%80%a6-you-can-use-devenvexe-edit-to-open-a-file-in-an-existing-visual-studio-instance-360/

  • Anonymous
    November 19, 2008
    Sara, Can you think of a scenario where this would be useful? What if I have several VS instances opened? Can I control which instance opens the file? Just curious.

  • Anonymous
    November 19, 2008
    Isn't that precisely what it does when you open any file of type associated with Visual Studio in the Shell (Explorer, etc)? For me at least, when I double-click a .cs or .cpp file, it seems to open it in a new tab in an existing VS window, if there is one. And it seems to pick the one I used last if there's more than one open.

  • Anonymous
    November 19, 2008
    How is this faster than drag&drop exactly :)

  • Anonymous
    November 19, 2008
    I think its meant for opening non-VS files such as text files inside VS. I couldnt get it working on my right-click SendTo menu though. Has anyone any ideas on that.

  • Anonymous
    November 26, 2008
    To add to the send to menu, create a shortcut with the following target: "C:Program FilesMicrosoft Visual Studio 8Common7IDEdevenv.exe" /edit or "C:Program FilesMicrosoft Visual Studio 9.0Common7IDEdevenv.exe" /edit