Notepad++ assumes .txt file extension when loading from a command line

  1. The standard filename for Notepad++ is Notepad++.exe, no notepad.exe. The last is the Windows standard notepad. So try

    notepad++ Dockerfile
    
  2. If it doesn't help, append the filename with the period (.):

    notepad++ Dockerfile.
    

    or - if your filename for Notepad++ is nevertheless notepad.exe:

    notepad Dockerfile.
    

Did a bit more research on this, and this appears to be by design. This actually does not repro if you run Notepad++ the normal way, using notepad++ Dockerfile instead of overriding the Image File Execution in the registry. Notepad++ has some code in the convertParamsToNotepadStyle method which basically mimics what Windows Notepad does by default, which is to add a .txt extension by default.

So, what causes Notepad++ to mimic Notepad? It turns out to be the -notepadStyleCmdline parameter, which is included in the instructions on how to replace Notepad. If you remove the parameter and override Notepad like so:

reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"%ProgramFiles%\Notepad++\notepad++.exe\" -z" /f

Then Notepad++ will behave like Notepad++.

Tags:

Notepad++