Force Windows 10 to always open hosts file with Notepad++
Solution 1:
You cannot associate files with no extension to be opened by a specific programs. Further, HOSTS needs to be opened with Notepad++ or Notepad or whatever editor in Admin mode.
So first you must get your editor in Admin mode. Then from there is is very easy to navigate to HOSTS and open it.
This is how I have done it for a very long time
Solution 2:
After creating fairly complex batch programs recently to open several programs (if they're not already open) I should have realized the answer:
C:\MEDIA\OFFICE\Notepad++\notepad++.exe C:\Windows\System32\drivers\etc\hosts
Solution 3:
This works for me in a batch file:
start notepad "C:\Windows\System32\drivers\etc\HOSTS"
Optional: Then you could make a shortcut to that batch file, give it the same icon as the HOSTS file (on Windows 10 it's the first icon in shell32.dll) and you'd never know any different :)
If you want to use Notepad++ just change the path to that instead of Notepad.