Open file safely in Notepad++
-
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.)
-
@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.execommand)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 thecmd.exeprompt to run the application from the command line: it properly reads the file in Notepad++, it doesn’t try to runcodesamples.txtas 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)
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