Use Shortcut or Context Menu for “Open Containing Folder” in Visual Studio

Open Containing Folder” is one of the frequent used functionality to open a particular file location in windows explore from Visual Studio IDE . How did we do that ? Yes it’s very simple, Just right click on file from files Tab and select “Open Containing Folder” from the context menu as shown in below.

1

This will open the selected item location in windows explorer. This operation by default having no keyboard shortcut. But do you know we can assign keyboard shortcut for the same or even we can customize the context menu in code editor to achieve the same as shown in below images.

4 5

This will be really helpful for you to work with “Open Containing Folder”. Though we can do it from the default process ( without shortcut ) but this will really save some amounts of your time, and time is money 🙂 .

Let see, How to do that.

Add Shortcut For Open Containing Folder :

This process is same for most the cases when you want to assign some key word shortcut for any of the Visual Studio Command. Before assign to shortcut to any of the command you should know the name of the command too. For “Open Containing Folder” Command name is “File.OpenContainingFolder”.

Navigate as VS IDE Menu > Tools > Options > Environment > Keyboard. Now, if you know the command you can directly scroll down the command list or Type few of the characters in the search text.

2

Once you the command “File.OpenContainingFolder” assign a shortcut key for the same. Here you may need to spend few time find out the unique shortcut key with some trial hit ( I have set as Ctrl + Shift + Q) .

3

Once you have the key, Click on “Assign” and OK. You are done ! Now from any open items in VS Studio if you press the shortcut key ( For me Ctrl + Shift + Q) , corresponding item will be open in windows explorer.

Add “Open Containing Folder” in Context Menu :

For this features you also need to use the same command (File.OpenContainingFolder) but the process is bit different.

Navigate from Tools > Customize . In Customize window, Move to the “Commands” Tab then select “Context Menu” option Button and “Editor Context Menus | Code Window” From the drop down list. Then Click on Add Command ( Step 1 ,2, 3 as shown in image )

6

Once you clicked on “Add Command” below screen will appear

7

From the above window select “File” from left “Categories” list and “Open Containing Folder” from “Commands” list. Click on OK.

You will find “Open Containing Folder” has been added in Customize Window’s Commands Tab.

8


Here you can use Move UP / Move Down to move the position of your command in context menu . You can also click on “Keyboard ..” button to give the shortcut keys from here. As you have already followed the first process you do not need to add the keyboard shortcut any more it will take the same.

ow you can right click on code editor and select ”Open Containing Folder” to open the current opened files in Windows Explorer.

5

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.