A handy feature while editing files within Visual Studio is to open up a Windows Explorer window for the folder that contains the selected file (perhaps to rename a set of files, or to change the attributes etc). This feature has been within the Visual Studio IDE for a few revisions. The easiest way to access it is to open a file in the editor, then right click on the file’s tab and select the “Open Containing Folder” menu option.
One problem with this feature is that it requires the file to be opened within the editor in order to be able to right click on its tab. For forms and other project files with complex editor behaviour it can be a timely exercise waiting for the file to load into the editor just to be able to right click on it.
A handy solution to this problem within Visual Studio 2008 is an add-on called the “PowerCommands for Visual Studio 2008“. This extension, written by Microsoft, adds a set of additional functionality to various context menus within the IDE. The two most relevant to this discussion are the “Open Command Prompt” and “Open Containing Folder” options available while right clicking files within the Solution Explorer window (as seen in the screenshot to the right). This saves needing to load the file within the editor in order to access this option and is a great productivity boost. For more details check out the Visual Studio Extensibility (VSX) team blog. The PowerCommands extension is worth installing for just this feature, but also introduces a range of additional ones you will soon not be able to live without.
Going even further
IDE productivity fanatics and keyboard power users may be interested in the following additional things which may further maximise the use of this feature:
- You could follow the “How to: Work with Shortcut key Combinations” article on MSDN in order to bind the feature to a keyboard shortcut. The command is “File.OpenContainingFolder”.
- You could add this feature as a menu item within the Tools menu by following the instructions recently given on the .NET Tip of The Day blog. I for one didn’t think about using Visual Studio environment variables such as $(ItemPath) within this dialog.
If you like these kinds of IDE productivity tips, you might like to subscribe to Sara Ford’s blog.