4

I have a file called Dockerfile in my directory:

enter image description here

I'm attempting to edit that file in Notepad++, so I type the command:

notepad Dockerfile

Notepad++ comes up, but it tries to open a file called Dockerfile.txt which doesn't exist:

enter image description here

Is there a way to configure Notepad++ to load the file given at the command line, and not assume it has any particular extension? Thanks!

Note: On my machine, Notepad.exe has been overwritten to point to Notepad++.

1
  • VS Code may be better to work on Dockerfile. It recognizes the format and does syntax highlighting on it – phuclv Sep 8 '19 at 2:25
5
  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.
    
2
3

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++.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.