open/edit files without extension
-
Initially I planned to add a new comment here:
https://community.notepad-plus-plus.org/topic/17472/open-edit-files-without-extension
but the thread is locked (yep, another community with this stupid rule to lock old threads, even unresolved ones). Okay then, take a new one:
this dialog appears when default Windows notepad is replaced with Notepad++, and I am trying to open hosts file from the command line:notepad.exe "C:\Windows\System32\drivers\etc\hosts"
Default notepad is replaced by registry change:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe] "Debugger"="\"C:\\Program Files\\Notepad++\\Notepad++.exe\" -notepadStyleCmdline -z"
I know a workaround for this, but this looks to be a bug in Notepad++.
-
@idizor ,
Notepad++ on its own has no difficulty in opening the hosts file with no extension, whether it is done from the File>Open menu inside notepad, or right clicking on hosts in Windows Explorer and choosing to open with Notepad++, or from the command line
"c:\program files\notepad++\notepad++.exe" "c:\windows\system32\drivers\etc\hosts"
.I have never used that hack of the OS to get Notepad++ to replace notepad.exe; the OS has multiple built-in methods of associating text files with a different application instead of Notepad++, and I always use those, rather than a workaround hack, and those work 100% reliably for me. (Open With, using the registry to edit the txtfile or .txt registry entries, or just using the right click “edit with notepad++” or equivalent key that gets applied in the
*
key to apply to all file types.)I don’t have admin privileges at work, so I cannot try the HKLM edit that is required for that hack, so I cannot confirm or contradict your experience with that hack. And I think the
-notepadStyleCmdline
option only works in that hack, so I cannot confirm whether it tries to auto-add the .txt extension from the command line using that option.I highly recommend using a normal Windows OS methodology of associating the files you want with Notepad++ instead of the hack.
-
@peterjones than you for the answer.
I agree that standard Windows associating methodology can cover a major number of usecases when working with text files. But sometimes Windows or some apps open files for you without asking what editor to use (under the hood they call default notepad in similar way like I specified above).
It looks like the parameter
-notepadStyleCmdline
was created specifically for this “hack” with replacing default notepad, but there is something wrong with parameter processing in NPP.