Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / All-Topics

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

5.00/5 (3 votes)
25 Nov 2010CPOL3 min read 27.5K  
Use Shortcut or Context Menu for “Open Containing Folder” in Visual Studio

“Open Containing Folder” is one of the frequently used functionality to open a particular file location in Windows Explorer 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 below:

1

This will open the selected item location in Windows Explorer. This operation by default has 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), this will really save some amount of your time, and time is money :) .

Let's see, how to do that.

Add Shortcut For Open Containing Folder

This process is the same for most cases when you want to assign some keyword shortcut for any of the Visual Studio commands. Before assigning shortcut to any of the commands, 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 a little time to 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), the corresponding item will be open in Windows Explorer.

Add “Open Containing Folder” in Context Menu

For this feature, 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”, the 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.

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

5

Summary

In this blog post, I described a small tip on how we can use “Open Containing Folder” features using shortcut key or from Context Menu. This is a very simple feature, but it is very useful.

Hope this will help you!

Cheers!

AJ
Shout it


Filed under: Tips and Tricks, Visual Studio

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)