“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.
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.
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.
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) .
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 )
Once you clicked on “Add Command” below screen will appear
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.
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.
Summary : In this blog post I described a small tips on how we can use “Open Containing Folder” features using shortcut key or from Context Menu. This is very simple features but It is very useful.
Hope this will help you !