Community
    • Login

    Open file safely in Notepad++

    Scheduled Pinned Locked Moved General Discussion
    2 Posts 2 Posters 1.0k Views 2 Watching
    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.
    • Bob HaikouB Offline
      Bob Haikou
      last edited by

      I’m sorry if this has been answered before. I couldn’t find it.

      In a batch file, I typed:

      start “C:\Program Files\Notepad++\notepad++.exe” “G:\codesamples.txt”

      In a powershell, I typed:

      start ‘C:\Program Files\Notepad++\notepad++.exe’ ‘G:\codesamples.txt’

      Notepad++ tried to execute the code in the text file! The computer went bananas. I think I tried “@ start .etc” and “start “” etc” and notepad++ still tried to execute the code.

      Is there a way to make notepad++ open a file with code safely, without running that code.

      Many thanks!

      Oh, and great software. Love it, (apart from that thing above.)

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        PeterJones @Bob Haikou
        last edited by PeterJones

        @Bob-Haikou said in Open file safely in Notepad++:

        Notepad++ tried to execute the code in the text file!

        I am highly confident that it was PowerShell or START, not Notepad++, that tried to execute that text – Notepad++ does not “run” it’s command-line arguments.

        You might want to read up on the documentation of START, and make sure that it’s PowerShell compatible (since it’s really a cmd.exe command)

        You can see that it’s not Notepad++'s fault by not using the START prefix, and by running "C:\Program Files\Notepad++\notepad++.exe" "G:\codesamples.txt" from the cmd.exe prompt to run the application from the command line: it properly reads the file in Notepad++, it doesn’t try to run codesamples.txt as an executable.

        My experiments show that start-process "C:\Program Files\Notepad++\notepad++.exe" "G:\codesamples.txt" should work for you from the PowerShell command line. But that’s really a PowerShell question, not a Notepad++ question, so any further followup should be in a forum that answers PowerShell questions (ie, not here in a Notepad++ forum)

        1 Reply Last reply Reply Quote 1

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors