• Login
Community
  • Login

build 7.6 "open with..." association does not open files with spaces in filenames

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 3 Posters 2.0k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F
    FredThompsonII
    last edited by Nov 26, 2018, 3:30 AM

    Builds up to an including 7.5.8 could be added to the Windows context menu to open any file. Here is the .reg file which allows this:


    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT*\shell\Notepad++]
    @=“Edit with &Notepad++”
    “Icon”=“C:\Portable\- Linked\Notepad++\notepad++.exe,0”

    [HKEY_CLASSES_ROOT*\shell\Notepad++\Command]
    @=“C:\Portable\- Linked\Notepad++\Notepad++.exe %L”


    Build 7.6 will NOT open files with spaces in their filenames.

    Why is this and what can be done to fix the problem?

    1 Reply Last reply Reply Quote 0
    • P
      PeterJones
      last edited by Nov 26, 2018, 8:35 PM

      Fix = put quotes around %L in the registry:

      Windows Registry Editor Version 5.00
      
      [HKEY_CLASSES_ROOT*\shell\Notepad++]
      @="Edit with &Notepad++"
      "Icon"="C:\Portable\- Linked\Notepad++\notepad++.exe,0"
      
      [HKEY_CLASSES_ROOT*\shell\Notepad++\Command]
      @="C:\Portable\- Linked\Notepad++\Notepad++.exe \"%L\""
      

      The “why” = the author changed handling of command-line arguments to be more consistent with other windows programs, where filenames with spaces on the command line must be surrounded by quotes to be interpreted as a single filename.

      1 Reply Last reply Reply Quote 2
      • P
        PeterJones
        last edited by PeterJones Nov 26, 2018, 8:39 PM Nov 26, 2018, 8:39 PM

        example for the why = otherwise,

        notepad++.exe a file here.txt
        

        would be ambiguous as to whether it’s opening one file called a file here.txt with spaces in the name, or whether it’s opening three files – one called a, one called file, and one called here.txt.

        If all four files existed, it would be impossible to grok your intention.

        Now, it requires

        notepad++.exe "a file here.txt"
        

        to tell it that it’s one filename, and will assume multiple filenames if there aren’t quotes around it.

        1 Reply Last reply Reply Quote 3
        • M
          MrSimurq
          last edited by Nov 29, 2018, 10:39 AM

          Are you sure the registry code above is correctly spelled? I tried this (adjusted for my Notepad++ location) but I get a registry error “This file doesn’t have associated program…”

          Windows Registry Editor Version 5.00

          [HKEY_CLASSES_ROOT*\shell\Notepad++]
          @=“Edit with &Notepad++”
          “Icon”=“C:\Notepad++\notepad++.exe,0”

          [HKEY_CLASSES_ROOT*\shell\Notepad++\Command]
          @=“C:\Notepad++\Notepad++.exe “%L””

          Thanks!

          1 Reply Last reply Reply Quote 1
          • P
            PeterJones
            last edited by PeterJones Nov 29, 2018, 2:26 PM Nov 29, 2018, 2:24 PM

            @MrSimurq ,

            Sorry, no – I had just copy/edit/pasted what was originally posted by @FredThompsonII , and didn’t notice that it was missing a \ before the *. For your example, I believe it should be:

            Windows Registry Editor Version 5.00
            
            [HKEY_CLASSES_ROOT\*\shell\Notepad++]
            @="Edit with &Notepad++"
            "Icon"="C:\\Notepad++\\notepad++.exe,0"
            
            [HKEY_CLASSES_ROOT\*\shell\Notepad++\command]
            @="C:\\Notepad++\\Notepad++.exe \"%L\""
            

            -----
            Aside: I believe what happened is that because the original poster did not indent the .reg text four spaces in the forum, the forum software converted the quotes to “smart quotes” (which I noticed and fixed) and also converted the \* to a plain * – it interpreted it as escaping the * character (which is used to start/stop emphasis and bold) instead of as wanting a literal \*. It also probably changed the \\ in the paths to \, and possibly converted \" to just “. That’s why Markdown provides the indenting feature for code blocks – to tell Markdown to treat the text as purely literal. I believe I have correctly edited your example to include all the correct escaping and quotes.

            In case it’s not, here’s my example from my registry: it’s for the “txtfile” entry, rather than the “*” entry, but it shows the syntax properly (because I know this association works):

            Windows Registry Editor Version 5.00
            
            [HKEY_CLASSES_ROOT\txtfile\shell\Notepad++]
            @="Notepad++"
            
            [HKEY_CLASSES_ROOT\txtfile\shell\Notepad++\command]
            @="C:\\Program Files (x86)\\Notepad++\\notepad++.exe \"%1\""
            

            -----
            edit: note: see this post for a link describing %1 vs %L in registry entries.

            1 Reply Last reply Reply Quote 1
            • P
              PeterJones
              last edited by PeterJones Nov 29, 2018, 2:29 PM Nov 29, 2018, 2:29 PM

              extra: in case you’re curious, since the OP used %L but my example used %1: see this post for a link describing %1 vs %L in registry entries. In short: it doesn’t really matter in this case, because the difference is only significant on old 16bit windows OS (like Win3.11). On modern Windows, %L and %1 are interchangeable in the registry associations. (Only %1 works in .bat/.cmd files, though, which is why I’ve gotten used to using %1.)

              1 Reply Last reply Reply Quote 2
              6 out of 6
              • First post
                6/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors