NP++ 7.7 insists on opening a text document with "txt" extension



  • Hi.

    I have run the “notepad++ replace notepad” hack (https://notepad-plus-plus.org/features/replace-notepad.html)

    I have a text file, called “one” (no extensions whatsoever). When I tried to open it with NP++ 7.7 via command prompt with “notepad one”, it tells me “<path>\one.txt” doesn’t exist. Create it?"

    I clicked “No”, then NPP opens but blank…

    But of course, from there, I can File-Open and choose “one” and it opens just fine.

    Quite frustrating…thanks for letting me rant…



  • Check your registry: my bet is that the %1 is not in quotes.

    See more details in this older topic: https://notepad-plus-plus.org/community/topic/16687/build-7-6-open-with-association-does-not-open-files-with-spaces-in-filenames



  • Hi PeterJones.

    Thanks for the reply. Sorry, but that didn’t help.

    I believe the problem is with the hack from the article that I linked above.

    From a command prompt, if I type “notepad textfile” (where ‘notepad’ will open notepad++), it fails…

    BUT, if I type “<full path>\notepad++.exe textfile”, it opens the file just fine.



  • One workaround is to use

    notepad one.
    

    with a period at the end. That will open the file with no extension.

    Another workaround is to remove the -notepadStyleCmdline command line argument from the https://notepad-plus-plus.org/features/replace-notepad.html thing. In other words, do:

    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
    

    -notepadStyleCmdline is not documented but I assume enables whatever command line options the original notepad.exe recognizes.



  • One more comment about that opening a file using the full path to notepad++ works.

    If you run

    notepad one
    

    then Windows executes the following:

    "C:\Program Files (x86)\Notepad++\notepad++.exe" -notepadStyleCmdline -z notepad  one
    

    You can experiment with removing the command line arguments which is how I found the problem is caused by the -notepadStyleCmdline parameter. The -z notepad parameter is also not documented but it appears the word notepad comes from Windows and the preceding -z is used to ignore the word “notepad” that Windows added to the command line.


Log in to reply