Search code examples
macroskeyboard-shortcutsvisual-studio-2012

"Open containing folder" hotkey in Visual Studio 2012


In versions of Visual Studio before 2012, I was able to create a hotkey to perform "Open Containing Folder" for the current active text file. I accomplished this by creating a macro that had a keystroke assigned to it.

Visual Studio 2012 does not have macros. How would I accomplish the above in this version?


Solution

  • Unfortunately you'll now need to download the VSSDK and create a VSPackage to do that, now that macros have been dropped from the IDE.

    The closest thing to a macro now is a PowerShell script, which you could run from the console but I'm not aware of any way to assign a keyboard shortcut to it.

    Running PS outside of the IDE is an option (via an External Tool command with a keyboard shortcut configured), but obtaining the EnvDTE outside of process could be complicated.

    EDIT: There is a much simpler solution. I can't believe I didn't realise it to begin with!

    Simply go into Tools... Options... Environment... Keyboard locate File.OpenContainingFolder and assign a shortcut. This command will open the active document's containing folder.