Set-OpenWithVisualStudioCode

When installing Visual Studio Code from downloaded setup file you can chose if you want to
Add “Open with Code” action to Windows Explorer file context menu and
Add “Open with Code” action to Windows Explorer directory context menu.

This is pretty nice to have.
Just Right-Click on a file, on a folder or in a folder and chose Open with Code.

But if you are doing a own silent installation or using the Install-VSCode.ps1 script from Microsoft these features will not be set as default.

I’m using the Install-VSCode.ps1 script to do automatic installation in my demo and lab environment and I wanted the right click set automaticaly as well.

So I created a little PowerShell function that sets It.

The function have 3 parameters.

-Scope (Mandatory)
User or System Installation

-File
Will set the right click option for files

-Directory
Will set the right click option for directory

The function can be downloaded from my PowerShell GitHub Repository.
https://github.com/FredrikWall/PowerShell/tree/master/Visual%20Studio%20Code

Download the script and change the parameters in the end of the script to make it as you want before you run it.




You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.