Welcome to MSDN Blogs Sign in | Join | Help

Sara Ford's Weblog

My adventures embracing open source on CodePlex and at Microsoft

News

    • Did you know... All author proceeds go directly to sending Hurricane Katrina survivors to college.

      Microsoft Visual Studio Tips book

      Recent Entries

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: ,
Posted: Wednesday, November 19, 2008 3:00 AM by saraford

Comments

Serge Wautier said:

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.

# November 19, 2008 12:24 PM

int19h said:

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.

# November 19, 2008 2:19 PM

Pepe said:

How is this faster than drag&drop exactly :)

# November 20, 2008 4:15 AM

VinceG said:

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.

# November 20, 2008 7:22 AM

Dennis said:

To add to the send to menu, create a shortcut with the following target:

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

or

"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" /edit

# November 27, 2008 3:58 AM
New Comments to this post are disabled
Page view tracker