#456 Patch for Feature: Open Containing Folder


I'm aware that a user can go to Run -> Open containing folder (I've seen this thread) but I don't feel that it is sufficient and is counter-intuitive. Also, it doesn't select the file when it opens the explorer window, so in a folder of 1000+ files, I'll have to then find it manually.

In this patch, I've added an 'Open Containing Folder' menu item to the Edit menu and the tab-bar popup menu.

The feature uses SHOpenFolderAndSelectItems() so I've made it check if it exists on the platform.

This is a much-needed feature.

1 Attachments


  • FLS

    FLS - 2013-02-24

    If you want to select the file in the explorer window when using "Run -> Open containing folder" then, you only have to adapt the code in the shortcuts.xml file:
    Original is:

    <Command name="Open containing folder" Ctrl="no" Alt="no" Shift="no" Key="0"
    >explorer $(CURRENT_DIRECTORY)</Command>

    replace it with:

    <Command name="Open containing folder" Ctrl="no" Alt="no" Shift="no" Key="0"
    >explorer /select,$(FULL_CURRENT_PATH)</Command>

    However, if an Explorer is already opened in the containing folder, the wanted file will not be selected! Only the Explorer window gets the focus. If you want to select it always, you need to open always a new Explorer with an "/n," or "/e," before "/select" (without blank between!).


    Last edit: FLS 2013-02-24
    • Don HO

      Don HO - 2013-12-07

      Thank you FLS, explorer /select,$(FULL_CURRENT_PATH) works fine.
      This command will be added as build-in command.


  • Adib

    Adib - 2013-02-28

    It's such a minuscule feature which I know would improve productivity. Also, it provides consistency between npp, microsoft's IDEs (vs, sql server, etc) and other programs which have this feature. @FLS: that's why people would prefer to have the feature I requested as opposed to having to edit the xml file for every installation on every machine (or copy/pasting the xml to every machine). Either way, this feature is more efficient for the user and you don't have to remember commands or command line options.

    There's very little leeway for potential bugs seeing as how the dll is loaded dynamically and I've already tested it to the best extent that I could and no bug has shown up.

    Also, there isn't much change to the UI other than an additional menu item. If you'd like, you can remove the menu item I placed in the edit menu. I put it there in case the user can't right click the tab for some reason, but I guess there's no harm leaving it there.

  • Andreas Jonsson

    Andreas Jonsson - 2013-03-03

    Yes, this is a great feature (I use it all the time in Visual Studio).

  • FLS

    FLS - 2013-05-01

    Dear Adib
    I applied your patch to Notepad++ 6.3.2 (SVN version 1036). Compiled with "Unicode Debug" option, it worked fine but compiling with "Unicode Release" option Notepad++ crashed with an error message like "Exeption: unknown software error (0xc0000409) occured in application ...". Proceeding with Just-In-Time Debugging tells something about buffer overflow. The Explorer with selected file is correctly opened, even when Notepad++ crashes.
    I am using WindowsXP SP3 and VS2008 Compiler.
    Would you mind having a look into that?

    Last edit: FLS 2013-05-01
  • Don HO

    Don HO - 2013-12-07
    • status: open --> closed