Community
    • Login

    Notepad++ 8.4.2 not recognizing file extension to define language

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    24 Posts 4 Posters 5.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.
    • PeterJonesP
      PeterJones @Pallieguy
      last edited by

      @pallieguy

      Here’s a way to do it where you cannot accidentally write anything: using the command-line REG QUERY which just grabs information from the registry without editing it. (For these instructions, I am assuming that even double-clicking a *.txt file is giving this wrong behavior. If not, replace the .txt below with an extension that double-clicks into Notepad++ but doesn’t identify correctly, like maybe .php, since that’s what started it all.)

      Open a command prompt

      REG QUERY HKCR\.txt /VE
      

      This will output something like:

      HKEY_CLASSES_ROOT\.txt
          (Default)    REG_SZ    txtfile
      

      Whatever the text is to the right of REG_SZ, use that in the next query:

      REG QUERY HKCR\txtfile
      

      Share those results with us (use the </> button on the forum toolbar to wrap your text in a black box like I did)

      For example, mine is:

      C:\usr\local\share>REG QUERY HKCR\.txt /VE
      
      HKEY_CLASSES_ROOT\.txt
          (Default)    REG_SZ    txtfile
      
      
      C:\usr\local\share>REG QUERY HKCR\txtfile
      
      HKEY_CLASSES_ROOT\txtfile
          (Default)    REG_SZ    Text Document
          EditFlags    REG_DWORD    0x210000
          FriendlyTypeName    REG_EXPAND_SZ    @%SystemRoot%\system32\notepad.exe,-469
      
      HKEY_CLASSES_ROOT\txtfile\DefaultIcon
      HKEY_CLASSES_ROOT\txtfile\shell
      

      Those will give the “old fashioned” file associations, which Windows used prior to Win10 (and still work in Win10 and Win11, though they are moving away from them)

      But since @giannis-raptis is on Win10, it might be useful to examine the newer “Open With” storage locations

      REG QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt /S
      REG QUERY HKCR\Applications\notepad++.exe /S
      

      Give us the output to both of those as well

      For the record, mine are:

      C:\usr\local\share>REG QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt /S
      
      HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithList
          a    REG_SZ    notepad.exe
          b    REG_SZ    cabd
          c    REG_SZ    EXCEL.EXE
          d    REG_SZ    notepad++.exe
          MRUList    REG_SZ    dce
          e    REG_SZ    chrome.exe
      
      HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithProgids
          txtfile    REG_NONE
      
      HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\UserChoice
          ProgId    REG_SZ    Applications\notepad++.exe
          Hash    REG_SZ    cK5ueCMWhb4=
      
      
      C:\usr\local\share>REG QUERY HKCR\Applications\notepad++.exe /S
      
      HKEY_CLASSES_ROOT\Applications\notepad++.exe
          FriendlyAppName    REG_SZ    Notepad++
          (Default)    REG_SZ    Notepad++ Text Document
      
      HKEY_CLASSES_ROOT\Applications\notepad++.exe\DefaultIcon
          (Default)    REG_SZ    "c:\usr\local\apps\notepad++\notepad++.exe",-100
      
      HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell
      
      HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open
          Icon    REG_SZ    c:\usr\local\apps\notepad++\notepad++.exe,-101
      
      HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open\command
          (Default)    REG_SZ    "C:\usr\local\apps\notepad++\notepad++.exe" "%1"
      

      And finally, grab

      REG QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts
      

      But that’s too big. So paste it into Notepad++, and then run the following replacement on it:

      • FIND WHAT: (?-s)^((?!Toasts|Notepad\+\+\.exe|\.txt).)*(\R|\Z)
      • REPLACE WITH: (empty)
      • hit Replace All

      Then copy/paste the filtered results from Notepad++ into a black </> box in your your reply as well.

      PallieguyP 1 Reply Last reply Reply Quote 1
      • PallieguyP
        Pallieguy @PeterJones
        last edited by

        @peterjones
        I tried a .txt to see if the language problem persisted and like after the .css yesterday, the language is back to being detected properly for all my files. If it happens again tomorrow I will run these commands and post them while it’s still wonky.

        First set of commands:

        C:\Users\Palli>REG QUERY HKCR\.php /VE
        
        HKEY_CLASSES_ROOT\.php
            (Default)    REG_SZ    php_auto_file
        
        
        C:\Users\Palli>REG QUERY HKCR\php_auto_file
        
        HKEY_CLASSES_ROOT\php_auto_file\shell
        

        Second two:

        C:\Users\Palli>REG QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.php /S
        
        HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.php\OpenWithList
            a    REG_SZ    firefox.exe
            b    REG_SZ    cab
            c    REG_SZ    {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\OpenWith.exe
            d    REG_SZ    dabc
            MRUList    REG_SZ    eabcd
            e    REG_SZ    notepad++.exe
        
        HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.php\OpenWithProgids
            php_auto_file    REG_NONE
        
        HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.php\UserChoice
            Hash    REG_SZ    8c5Dq+bAc2A=
            ProgId    REG_SZ    Applications\notepad++.exe
        
        
        C:\Users\Palli>REG QUERY HKCR\Applications\notepad++.exe /S
        
        HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell
        
        HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open
        
        HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open\command
            (Default)    REG_SZ    "D:\Notepad++\notepad++.exe" "%1"
        

        Filtered last command:

        HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts
            txtfile_.txt    REG_DWORD    0x0
            textfile_.txt    REG_DWORD    0x0
            Applications\notepad++.exe_.sfv    REG_DWORD    0x0
            Applications\notepad++.exe_.srt    REG_DWORD    0x0
            Applications\notepad++.exe_.ssa    REG_DWORD    0x0
            soffice.StarWriterDocument.6_.txt    REG_DWORD    0x0
            soffice.StarCalcDocument.6_.txt    REG_DWORD    0x0
            Applications\notepad++.exe_.txt    REG_DWORD    0x0
            Applications\notepad++.exe_.php    REG_DWORD    0x0
            Applications\NOTEPAD.EXE_.txt    REG_DWORD    0x0
            Applications\notepad++.exe_.gcode    REG_DWORD    0x0
            Applications\notepad++.exe_.pl    REG_DWORD    0x0
            Applications\notepad++.exe_.css    REG_DWORD    0x0
            Applications\notepad++.exe_.js    REG_DWORD    0x0
            Applications\notepad++.exe_.orig    REG_DWORD    0x0
            Applications\notepad++.exe_.ini    REG_DWORD    0x0
            Applications\notepad++.exe_.log    REG_DWORD    0x0
            Applications\notepad++.exe_.fasta    REG_DWORD    0x0
            Applications\notepad++.exe_.htaccess    REG_DWORD    0x0
            Applications\notepad++.exe_.cpp    REG_DWORD    0x0
            Applications\notepad++.exe_.h    REG_DWORD    0x0
            Applications\notepad++.exe_.cfg    REG_DWORD    0x0
            Applications\notepad++.exe_.pem    REG_DWORD    0x0
            Applications\notepad++.exe_.html    REG_DWORD    0x0
            Applications\notepad++.exe_.json    REG_DWORD    0x0
            Applications\notepad++.exe_.lock    REG_DWORD    0x0
            Applications\notepad++.exe_.gitignore    REG_DWORD    0x0
            AppX4ztfk9wxr86nxmzzq47px0nh0e58b8fw_.txt    REG_DWORD    0x0
            Applications\notepad++.exe_.test    REG_DWORD    0x0
            Applications\notepad++.exe_.old    REG_DWORD    0x0
            Applications\notepad++.exe_.new    REG_DWORD    0x0
            Applications\notepad++.exe_.xml    REG_DWORD    0x0
            Applications\notepad++.exe_.bar    REG_DWORD    0x0
            Applications\notepad++.exe_.htpasswd    REG_DWORD    0x0
            Applications\notepad++.exe_.env    REG_DWORD    0x0
        
        PeterJonesP 1 Reply Last reply Reply Quote 1
        • PeterJonesP
          PeterJones @Pallieguy
          last edited by

          @pallieguy ,

          I wonder if one of your plugins is causing Notepad++ to have intermittent difficulty in identifying the file type. Weird. If it goes back to happening, share your ?-menu’s Debug Info like @Giannis-Raptis did.

          Also, if it happens again, try closing Notepad++ and renaming your c:\program files\notepad++\plugins directory (which is one of the steps in this FAQ, which though it claims to be about crashing, is also a general-purpose see-if-plugin-is-causing-problem instruction set; because your problem is only with double-click, you cannot easily use option #1, but option #2 will still work for you)

          PallieguyP 2 Replies Last reply Reply Quote 0
          • PallieguyP
            Pallieguy @PeterJones
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • PallieguyP
              Pallieguy @PeterJones
              last edited by Pallieguy

              @peterjones
              I haven’t installed any plugins that I’m aware of, but I’ll try that after posting if it happens again tomorrow.

              Debug info:

              Notepad++ v8.4.2   (64-bit)
              Build time : May 29 2022 - 16:47:30
              Path : C:\Program Files\Notepad++\notepad++.exe
              Command Line : "D:\Dropbox (xxxx)\xxxx\Coding\xxxx\web\content\submissions\permissionForm\index.php"
              Admin mode : OFF
              Local Conf mode : OFF
              Cloud Config : OFF
              OS Name : Windows 10 Pro (64-bit) 
              OS Version : 21H2
              OS Build : 19044.1766
              Current ANSI codepage : 1252
              Plugins : 
                  mimeTools (2.8)
                  NppConverter (4.4)
                  NppExport (0.4)
              
              PeterJonesP 1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @Pallieguy
                last edited by

                @pallieguy said in Notepad++ 8.4.2 not recognizing file extension to define language:

                I haven’t installed any plugins that I’m aware of

                Your Debug Info agrees: you only have the default plugins, which aren’t the culprit.

                Well, let us know if the problem comes back.

                PallieguyP 1 Reply Last reply Reply Quote 0
                • PallieguyP
                  Pallieguy @PeterJones
                  last edited by

                  @peterjones
                  Day three and the same problem. Only difference is I didn’t shut down the computer last night.

                  First commands:

                  C:\Users\Palli>REG QUERY HKCR\.php /VE
                  
                  HKEY_CLASSES_ROOT\.php
                      (Default)    REG_SZ    php_auto_file
                  
                  
                  C:\Users\Palli>REG QUERY HKCR\php_auto_file
                  
                  HKEY_CLASSES_ROOT\php_auto_file\shell
                  

                  Second Set:

                  C:\Users\Palli>REG QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.php /S
                  
                  HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.php\OpenWithList
                      a    REG_SZ    firefox.exe
                      b    REG_SZ    cab
                      c    REG_SZ    {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\OpenWith.exe
                      d    REG_SZ    dabc
                      MRUList    REG_SZ    eabcd
                      e    REG_SZ    notepad++.exe
                  
                  HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.php\OpenWithProgids
                      php_auto_file    REG_NONE
                  
                  HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.php\UserChoice
                      Hash    REG_SZ    8c5Dq+bAc2A=
                      ProgId    REG_SZ    Applications\notepad++.exe
                  
                  
                  C:\Users\Palli>REG QUERY HKCR\Applications\notepad++.exe /S
                  
                  HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell
                  
                  HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open
                  
                  HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open\command
                      (Default)    REG_SZ    "D:\Notepad++\notepad++.exe" "%1"
                  

                  Filtered last command:

                  HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts
                      txtfile_.txt    REG_DWORD    0x0
                      textfile_.txt    REG_DWORD    0x0
                      Applications\notepad++.exe_.sfv    REG_DWORD    0x0
                      Applications\notepad++.exe_.srt    REG_DWORD    0x0
                      Applications\notepad++.exe_.ssa    REG_DWORD    0x0
                      soffice.StarWriterDocument.6_.txt    REG_DWORD    0x0
                      soffice.StarCalcDocument.6_.txt    REG_DWORD    0x0
                      Applications\notepad++.exe_.txt    REG_DWORD    0x0
                      Applications\notepad++.exe_.php    REG_DWORD    0x0
                      Applications\NOTEPAD.EXE_.txt    REG_DWORD    0x0
                      Applications\notepad++.exe_.gcode    REG_DWORD    0x0
                      Applications\notepad++.exe_.pl    REG_DWORD    0x0
                      Applications\notepad++.exe_.css    REG_DWORD    0x0
                      Applications\notepad++.exe_.js    REG_DWORD    0x0
                      Applications\notepad++.exe_.orig    REG_DWORD    0x0
                      Applications\notepad++.exe_.ini    REG_DWORD    0x0
                      Applications\notepad++.exe_.log    REG_DWORD    0x0
                      Applications\notepad++.exe_.fasta    REG_DWORD    0x0
                      Applications\notepad++.exe_.htaccess    REG_DWORD    0x0
                      Applications\notepad++.exe_.cpp    REG_DWORD    0x0
                      Applications\notepad++.exe_.h    REG_DWORD    0x0
                      Applications\notepad++.exe_.cfg    REG_DWORD    0x0
                      Applications\notepad++.exe_.pem    REG_DWORD    0x0
                      Applications\notepad++.exe_.html    REG_DWORD    0x0
                      Applications\notepad++.exe_.json    REG_DWORD    0x0
                      Applications\notepad++.exe_.lock    REG_DWORD    0x0
                      Applications\notepad++.exe_.gitignore    REG_DWORD    0x0
                      AppX4ztfk9wxr86nxmzzq47px0nh0e58b8fw_.txt    REG_DWORD    0x0
                      Applications\notepad++.exe_.test    REG_DWORD    0x0
                      Applications\notepad++.exe_.old    REG_DWORD    0x0
                      Applications\notepad++.exe_.new    REG_DWORD    0x0
                      Applications\notepad++.exe_.xml    REG_DWORD    0x0
                      Applications\notepad++.exe_.bar    REG_DWORD    0x0
                      Applications\notepad++.exe_.htpasswd    REG_DWORD    0x0
                      Applications\notepad++.exe_.env    REG_DWORD    0x0
                  

                  Possible solution
                  I find out that if N++ is closed and I open the file through Windows Explorer, then language is detected and everything works, even if I open new files. If I open N++ from my taskbar shortcut (Set by right clicking an open N++ and selecting Pin to taskbar) then double click on the file in Windows Explorer is the only time it seems to not be working. Opening N++ by opening the file in my taskbar also shows a second N++ icon in that taskbar:
                  359ca8c8-672f-4f41-a814-8b41d2f4abcf-image.png

                  Unpinning the old shortcut (originally pinned so long ago I don’t recall which N++ version it was) and pinning the new one Fixed the problem entirely. It may be that enough time has passed for the problem to resolve itself like when I tried the txt and css files, so I’ll have another update tomorrow, but it appears the issue had to do with the shortcut made for an older version of N++.

                  PallieguyP PeterJonesP 2 Replies Last reply Reply Quote 1
                  • PallieguyP
                    Pallieguy @Pallieguy
                    last edited by

                    I missed the edit window to correct this, sorry.

                    Before my taskbar screenshot I meant to say:
                    Opening N++ by opening a file in Windows Explorer also shows a a second N++ icon in my taskbar:

                    1 Reply Last reply Reply Quote 0
                    • PeterJonesP
                      PeterJones @Pallieguy
                      last edited by PeterJones

                      @pallieguy said in Notepad++ 8.4.2 not recognizing file extension to define language:

                      Unpinning the old shortcut (originally pinned so long ago I don’t recall which N++ version it was) and pinning the new one Fixed the problem entirely.

                      Yeah. I wonder if you still have a residual notepad++ installation somewhere else other than your newly-pinned shortcut.

                      Actually, your data actually already shows that. Earlier, you were running from C:\Program Files\Notepad++\notepad++.exe, as your Debug Info showed. Your REG QUERY output showed

                      HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open\command
                          (Default)    REG_SZ    "D:\Notepad++\notepad++.exe" "%1"
                      

                      (though I didn’t see it yesterday, because I didn’t scroll far enough in your black box)

                      So when you double-click when no notepad++ was running, it ran your D:-drive copy of Notepad++. If you used your old shortcut, it was apparently running your C:-drive copy … and then, because you presumably don’t have multi-instance enabled, when you double clicked, it tried to run the D:-drive copy, but saw the C:-drive copy running and opened the file with that instead.

                      Since I believe you pinned the copy that was associated, I believe your pin should now point to the D:-drive copy. If so, I would recommend removing the C:-drive copy, to avoid future confusion. But check your pin to make sure: right click on the pin, then right click on the notepad++ near the bottom, then select “properties”: the Target field will show which one is now pinned.

                      PallieguyP 1 Reply Last reply Reply Quote 3
                      • PallieguyP
                        Pallieguy @PeterJones
                        last edited by

                        @peterjones
                        I do indeed have a C: and a D: install, I wonder when I did that?

                        Glad this is resolved, thanks fro all your help!

                        PeterJonesP 1 Reply Last reply Reply Quote 1
                        • PeterJonesP
                          PeterJones @Pallieguy
                          last edited by

                          @pallieguy said in Notepad++ 8.4.2 not recognizing file extension to define language:

                          I wonder when I did that?

                          Probably at one of the updates: there was a while when the installer would not notice an old installation if it wasn’t in c:\program files\notepad++, so even if you had installed to D:\notepad++\, the updater/installer would put the newer copy in c:\program files\notepad++ instead. IIRC, that has been fixed (I spent a couple minutes searching through the issues list, but wasn’t using a narrow enough set of search terms, so couldn’t find it buried in all the other results), so the next time you run the installer/updater for whatever version you end up keeping, it should hopefully default to the existing location.

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