Community
    • Login

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

    Scheduled Pinned Locked Moved General Discussion
    5 Posts 3 Posters 1.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Nicholas SuN
      Nicholas Su
      last edited by

      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…

      1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones
        last edited by

        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

        1 Reply Last reply Reply Quote 3
        • Nicholas SuN
          Nicholas Su
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • mkupperM
            mkupper
            last edited by

            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.

            1 Reply Last reply Reply Quote 1
            • mkupperM
              mkupper
              last edited by

              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.

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors