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