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.
Oh, and great software. Love it, (apart from that thing above.)
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
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.exeprompt to run the application from the command line: it properly reads the file in Notepad++, it doesn’t try to run
codesamples.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)