0

I've got thousands of files with extensions ".0", ".1", ".2", etc. that I want to associate with Notepad++ (v7.5.8). They currently don't have any file association in Windows (Windows 10). Since they don't have any existing association, the solutions shown here aren't working for me.

Also, I'm looking to associate them in Windows, not in the N++ settings, since I access these files from Windows Explorer.

1
  • How many different file extensions are we talking about? You could associate a single file, export the key, then use Excel to generate the X keys by Cating strings
    – Ramhound
    Nov 29, 2018 at 16:04

1 Answer 1

0

Much easier than manually associating all the .# files, IMO, would be to set up a catch-all edit mode, using regedit:

  • HKEY_CLASSES_ROOT\*\shell: Add Key = Notepad++, set (Default) = Edit with &Notepad++
  • HKEY_CLASSES_ROOT\*\shell\Notepad++: Add Key = command, set (Default) to "c:\program files (x86)\notepad++\notepad++.exe" "%1" -- use the correct path to notepad++.exe for your system, and make sure to have the double-quotes around both the path and the %1, to make sure spaces are handled correctly.

Log off and back on, or reboot. Now, on any file in explorer, you should be able to right-click, select Edit with Notepad++, and voila!


Per-Extension Association (All Users)

Alternately, open up a cmd.exe window (run-as-admin if necessary), and run

assoc .1=DotNumber
ftype DotNumber="c:\program files (x86)\notepad++\notepad++.exe" "%1"
for %n in (0 1 2 3 4 5 6 7 8 9) DO assoc .%n=DotNumber 

If you want more .# extensions, add them to the for loop. If you want to set them from a batch file (setdotn-assoc.bat or setdotn-assoc.cmd) rather than at the cmd.exe prompt, need two % rather than just one, everything else is the same:

assoc .1=DotNumber
ftype DotNumber="c:\program files (x86)\notepad++\notepad++.exe" "%1"
for %%n in (0 1 2 3 4 5 6 7 8 9) DO assoc .%%n=DotNumber

Per-Extension Association (Just for Current User)

If you're having problems with permissions on All Users, you can try this to do the per-extension association, but just for the current user.

In case you were able to create DotNumber type, ftype DotNumber= to remove the existing definition.

Run the following from the command line (shouldn't even need an Administrator command line this time)

REG ADD     HKCU\Software\Classes\DotNumber                      /ve /d "DotNumber File" /f
REG ADD     HKCU\Software\Classes\DotNumber\Shell                /ve /d "open" /f
REG ADD     HKCU\Software\Classes\DotNumber\Shell\open           /ve /d "open DotNumber file" /f
REG ADD     HKCU\Software\Classes\DotNumber\Shell\open\command   /ve /d "\"c:\program files (x86)\notepad++\notepad++.exe\" \"^%1\"" /f
FOR %n in (0 1 2 3 4 5 6 7 8 9) DO REG ADD HKCU\Software\Classes\.%n /ve /d "DotNumber" /f

And if you want to check if it was written

REG QUERY   HKCU\Software\Classes\DotNumber /S
FOR %n in (0 1 2 3 4 5 6 7 8 9) DO REG QUERY HKCU\Software\Classes\.%n /S
8
  • Thank you! The command window method seems to work, except it's a work computer and for each extension it just returns an "Access is denied" error, even when I run it as an admin. Darn.
    – Merlin820
    Jan 31, 2019 at 19:23
  • Did it create the filetype or not? ftype DotNumber will say "File type 'DotNumber' not found or no open command associated with it" if it wasn't created, otherwise it will show the definition...
    – PeterCJ
    Jan 31, 2019 at 19:35
  • Added a "current-user-only" version in newest edit. This one shouldn't matter whether or not you have Admin privileges. At least, it worked for me in a non-admin window.
    – PeterCJ
    Jan 31, 2019 at 20:12
  • The Current User version worked! I don't know much about registry stuff, mind explaining a few things? What does the value of each subkey you create mean? Like, does having HKCU\Software\Classes\DotNumber\Shell have the value "open" mean something in particular? Is "open" a magic word? Is having "Shell" in the registry tree also special?
    – Merlin820
    Feb 1, 2019 at 20:47
  • 1
    This has all been really helpful, thank you! And actually my NPP is in the regular program folders file, not x86, so I probably don't have to worry about that DO loop issue. Thanks again!
    – Merlin820
    Feb 4, 2019 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .