Open Files in Visual Studio Code from PowerShell Prompt

While working on some of the Learn Chef Rally courses I got tired of opening files in Visual Studio code to edit them and wondered if I could just open them directly from the PowerShell prompt that I was working in.  On a whim I decided to just try this and see if it worked:

And much to my surprise, it opened in Visual Studio Code!

When I posted about this on Twitter Joey Piccola replied back that you can also open an entire directory in Visual Studio Code by typing this command in the directory you want to open:

And it will open a new Visual Studio Code window!


I did some Google searching and looked in the documentation to see if there were any other things you could with Visual Studio Code from the PowerShell prompt but I didn’t find these ‘tricks’ listed anywhere.

If this is documented somewhere or if there are other ‘tricks’ like this please let me know in the comments or on Twitter and I will update the post accordingly.