How to open Visual Studio Code from git bash in Windows

I wanted to be able to open Visual Studio Code from my current folder while in git bash on Windows. I tried a couple different methods which included calling Update.exe, which is what my VS Code shortcut calls. It looks like this

But I was having issues passing the options I wanted to this .exe.

There is also the batch file that is executed when you run code on the command line.

It can be found here

This .cmd should be in your PATH if you want to run it from the command line. Its contents are the following

Trying to translate this batch script to bash was looking to be more of a headache than I wanted to deal with.

I then thought, “why don’t I call the batch script, which does everything I want already, from git bash?”

So I created an alias in my .bashrc for the batch file.

Now I can use the VS Code command line options from bash, for example

which opens the current folder in a new Code window.


   2 Comments


Leave a Reply