How to open files from cygwin into Visual Studio

Had the desire to open files from the command line (a cygwin terminal, mintty, to be specific) into my existing session of Visual Studio 2008. Here is what you can do.

Adjust paths as necessary. Put this in your bash profile:

export PATH=$PATH:/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 9.0/Common7/IDE/
alias devedit="devenv \$1 /edit"

Now, this gives you two tools. Well, one, but two will be available on the command line.

The main tool you now have is devenv, which allows you to do all sorts of things. type devenv /? to see all the things you can do with it.

We are interested in devenv filename /edit. I would prefer to just type the filename, and not need to type /edit everytime. The alias devedit takes care of this for us. So, you can do devenv whatever to have access to all the features that tool gives you, and you can do devedit filename to quickly open up the file in your existing Visual Studio session. If there is no session running, it will start one up.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">