file:///folder opens CMD instead of explorer



  • Hi everyone,

    I often use the feature of Notepad++ to open local directories like C:\tmp by using file:///C:\tmp with a double click.

    So far so good.

    Because I want to get something like the former CMD-Here function I followed the description of Microsoft blog. Here you can get the registry files I used to implement it. After applying the registry changes a double click on file:///C:\tmp opens the CMD prompt instead of the explorer.

    Do you have any idea how I can get the CMD-Here function and double click on file:///C:\tmp opens the explorer?

    Even hints where I can ask this question are welcome.

    Kind Regards
    Thomas



  • @tho-gru

    So you want both functionalities available, explorer and cmd prompt, on a single link. You’ve indicated that double-click would/should do one, but how do you envision invoking the other functionality?



  • Hi Alan,

    I expressed it miss leading, sorry.

    I want to double click in notepad++ to open the directory in the explorer.

    On the other hand when I have the explorer opened I want to have the CMD-here function.

    But with my current registry file (which is based on the Microsoft blog) the default action of notepad++ for the file:… link changed from “open explorer” to “open CMD”.

    I want to have:

    1. double click in notepad++ on file:/… open the explorer
    2. CMD-here function in explorer itself

    Kind Regards
    Thomas



  • @tho-gru

    So what you’re really saying is that you messed up how the double-click works in Notepad++, so you want to know how to put it back the way it was.

    It really doesn’t have anything to do with Notepad++. Notepad++, when doubleclicking a link runs Windows’ association for file://, so you have to fix that outside of Notepad++.

    Creating a “Cmd prompt here” is really outside of scope for this forum.



  • @Alan-Kilborn said in file:///folder opens CMD instead of explorer:

    Creating a “Cmd prompt here” is really outside of scope for this forum.

    That may be. But I’m glad @tho-gru brought it up, because I had never seen that MS article, and didn’t know you could add submenus in the right-click context menu.

    I now have a Notepad++ Extras submenu, along with my normal Edit With Notepad++ for all files
    84183169-234f-4f52-b3d2-a64858184018-image.png
    And that’s just cool!

    My path to notepad++.exe will be different than yours, and the icons I chose require NPP v8.0 or newer, but this is a registry export that will recreate the Notepad++ Extras submenu

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Classes\*]
    
    [HKEY_CURRENT_USER\Software\Classes\*\ContextMenus]
    
    [HKEY_CURRENT_USER\Software\Classes\*\ContextMenus\ExtraNotepad++]
    
    [HKEY_CURRENT_USER\Software\Classes\*\ContextMenus\ExtraNotepad++\shell]
    
    [HKEY_CURRENT_USER\Software\Classes\*\ContextMenus\ExtraNotepad++\shell\0.NewInstance]
    "MUIVerb"="Open in New Instance"
    "Icon"="\"C:\\usr\\local\\apps\\notepad++\\notepad++.exe\",-1537"
    
    [HKEY_CURRENT_USER\Software\Classes\*\ContextMenus\ExtraNotepad++\shell\0.NewInstance\command]
    @="\"C:\\usr\\local\\apps\\notepad++\\notepad++.exe\" -multiInst -nosession \"%1\""
    
    [HKEY_CURRENT_USER\Software\Classes\*\ContextMenus\ExtraNotepad++\shell\1.FolderAsWorkspace]
    "Icon"="C:\\usr\\local\\apps\\notepad++\\notepad++.exe,-202"
    "MUIVerb"="Open Folder As Workspace"
    
    [HKEY_CURRENT_USER\Software\Classes\*\ContextMenus\ExtraNotepad++\shell\1.FolderAsWorkspace\command]
    @="\"C:\\usr\\local\\apps\\notepad++\\notepad++.exe\" -multiInst -nosession -openFoldersAsWorkspace \"%W\""
    
    [HKEY_CURRENT_USER\Software\Classes\*\ContextMenus\ExtraNotepad++\shell\2.AsSession]
    "MUIVerb"="Open As Session"
    "Icon"="C:\\usr\\local\\apps\\notepad++\\notepad++.exe,-1539"
    
    [HKEY_CURRENT_USER\Software\Classes\*\ContextMenus\ExtraNotepad++\shell\2.AsSession\command]
    @="\"C:\\usr\\local\\apps\\notepad++\\notepad++.exe\" -openSession \"%1\""
    
    [HKEY_CURRENT_USER\Software\Classes\*\shell]
    
    [HKEY_CURRENT_USER\Software\Classes\*\shell\3ExtraNotepad++]
    "MUIVerb"="Notepad++ Extras"
    "Icon"="C:\\usr\\local\\apps\\notepad++\\notepad++.exe"
    "ExtendedSubCommandsKey"="*\\ContextMenus\\ExtraNotepad++"
    
    [HKEY_CURRENT_USER\Software\Classes\*\shell\2.Notepad++]
    @="Edit With Notepad++"
    "Icon"=hex(2):43,00,3a,00,5c,00,75,00,73,00,72,00,5c,00,6c,00,6f,00,63,00,61,\
      00,6c,00,5c,00,61,00,70,00,70,00,73,00,5c,00,6e,00,6f,00,74,00,65,00,70,00,\
      61,00,64,00,2b,00,2b,00,5c,00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2b,\
      00,2b,00,2e,00,65,00,78,00,65,00,00,00
    
    [HKEY_CURRENT_USER\Software\Classes\*\shell\2.Notepad++\command]
    @="\"C:\\usr\\local\\apps\\notepad++\\notepad++.exe\" \"%1\""
    
    

    (And to comment on @tho-gru’s misinformation: properly following the MS blog will not change the default action for file:///... links in Notepad++ or for double-clicking on a directory in Explorer. It only adds to Windows Explorer’s right-click context menu choices, not changing the default action. So something else must have gone wrong while doing things not described in that blog. But it’s not a Notepad++ problem, so @tho-gru will have to go elsewhere to figure out how the default association for directories got messed up on their system, and how to fix it.)


    edit to post: added my Edit with Notepad++ to the registry export



  • Hi @PeterJones, hi @Alan-Kilborn,

    Thanks for your feedback.

    I know that my question does not really match the forum themes. But here are some developers which are interested in helping each other.

    Can you recommend a forum or similar place (stackoverflow …) where I may be will get an answer?

    Thanks for your help.

    Kind Regards
    Thomas



  • @tho-gru said in file:///folder opens CMD instead of explorer:

    Can you recommend a forum or similar place (stackoverflow …) where I may be will get an answer?

    I’m not even really sure what the question is, but it could very well be that stackoverflow is an appropriate place.



  • Hello everyone,

    One solution to my problem is to replace all occurrences of open with command-exec in the registry file:

    Windows Registry Editor Version 5.00
    
    ; Command Prompt
    
    [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\shell\XxX-01MenuCmd]
    "MUIVerb"="@shell32.dll,-22022"
    "Icon"="cmd.exe"
    "ExtendedSubCommandsKey"="Directory\\ContextMenus\\XxX-MenuCmd"
    
    [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\background\shell\XxX-01MenuCmd]
    "MUIVerb"="@shell32.dll,-22022"
    "Icon"="cmd.exe"
    "ExtendedSubCommandsKey"="Directory\\ContextMenus\\XxX-MenuCmd"
    
    [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\ContextMenus\XxX-MenuCmd\shell\command-exec]
    "MUIVerb"="@shell32.dll,-8506"
    "Icon"="cmd.exe"
    
    [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\ContextMenus\XxX-MenuCmd\shell\command-exec\command]
    @="cmd.exe /s /k pushd \"%V\""
    
    [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\ContextMenus\XxX-MenuCmd\shell\runas]
    "MUIVerb"="@shell32.dll,-37444"
    "Icon"="cmd.exe"
    "HasLUAShield"=""
    
    [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\ContextMenus\XxX-MenuCmd\shell\runas\command]
    @="cmd.exe /s /k pushd \"%V\""
    
    

    Now I have the enhanced context menu at the folder and a double click on file:///c:\tmp starts the windows file explorer.

    Remark: The items in the submenu are displayed by the lexical order (1. command-exec, 2. runas …).

    Thanks for you help.

    Kind Regards
    Thomas


Log in to reply