How to make a shortcut to notepad++ in my desktop so it always opens a new file instead of the last one edited?
-
Tittle.
I remember doing something similar with another program in the past, kinda like editing the target column in the properties of the shortcut
“D:\Programs\Notepad++\notepad++.exe +newfile” or something like that
-
@TyrantRC said:
+newfile” or something like that
In Notepad++, click on the
?
in the top menu , right side. There is the "Commandline Arguments’ sub menu which will show you the options available.-nosession is likely what you want.
Terry
-
important note:
if you use the -nosessions switch, like
"C:\Program Files (x86)\Notepad++\notepad++.exe" -nosession
, you will lose all eventually created and unsaved tabs you had before.also using the -nosessions switch even just once, will permanently disable
settings > preferences > backup > enable session snapshot and periodic backup
, so you will not be able to close notepad++ without saving unsaved tabs.alternative:
if you really never, ever need notepad++ to re-open any of your previous files, and you want it to always open with a
new 1
tab:
you can do that in your notepad++ settings, without any need for a special desktop shortcut.
please go tosettings > preferences > backup
and disableremember current session for next launch
. -
@TyrantRC said:
I remember doing something similar with another program in the past, kinda like editing the target column in the properties of the shortcut
“D:\Programs\Notepad++\notepad++.exe +newfile” or something like that
create a .bat or .cmd file as “D:\Programs\Notepad++\notepad++.exe myfile.txt”
and create a desktop shortcut from this file.
there are many examples -
@Meta-Chuh This was very helpful since I don’t really wanna disable that feature, I just wanna open a a new file with one click from different shortcut of my usual one. I’m gonna make a custom batch like @gurikbal-singh said
-
@Terry-R Do you know if I can do something similar but without losing the session? something like opening the session plus a new file without saving it anywhere, just like when you press the “new” button, you don’t close your session but you kinda create a temporal file without any route unless you save it somewhere. I know you can just press the button, but somehow it’s always takes me like 3 seconds to do it and I do this often enough to be annoying.
I tried adding the name of a file “new” as an argument, but it saves it as a file in the notepad++ directory, I just want something temporal that I can close off whenever I finish with the task at hand. I also know it doesn’t save it anywhere because if you check in file > open container folder, there is nothing there.
-
if I can do something similar but without losing the session?
for your case, i would recommend to use the portable notepad++ version in addition to your installed notepad++ (like i do).
the portable version runs completely independent and isolated from your installed version, and all custom settings (as well as any stuff you might want to try at the portable version), will not modify anything on your installed version.
this way you have your full session enabled installed notepad++, plus an independent notepad++, which always opens a
new 1
tab, without touching or deleting any sessions of your mainly used installed version.guide:
-
download the portable notepad++ version 7.6.4. from >>> here <<< and extract
npp.7.6.4.bin.zip
. -
create the folder structure
C:\PortableApps\Notepad++\
. -
copy all contents from
npp.7.6.4.bin.zip
toC:\PortableApps\Notepad++\
. -
create a normal desktop shortcut icon, without any switches, for
C:\PortableApps\Notepad++\notepad++.exe
-
open up this portable notepad++ using your created shortcut.
-
go to
settings > preferences > backup
at your portable notepad++, and disableremember current session for next launch
.
(this will set the portable version to always open up with anew 1
tab.) -
go to
settings > preferences > multi-instance
at your portable notepad++, and set it toalways in multi-instance mode
(this will allow you to use this portable notepad++, even if your installed notepad++ is already open. it will not interfere with any sessions or unsaved tabs, and you can have both open at the same time for e.g. comparison)
if your workflow is similar to mine, this dual independent notepad++ setup will be the most flexible, as we do not have to worry about any settings conflicting with each other, and we can also have different, isolated sets of plugins on each notepad++.
note: if you want, you can set a different colour theme for the portable notepad++ at
settings > style configurator > select theme
, to better distinguish which notepad++ is which. -
-
@Meta-Chuh said:
this way you have your full session enabled installed notepad++, plus an independent notepad++, which always opens a new 1 tab,
I have not tried this technique, but a thought occurred to me that it would be interesting if both could be running at the same time. As I said, I haven’t tried that exact thing, but I have noticed in the past that if I wanted to run, say, Notepad++ 7.6.3 and Notepad++ 6.9 at the same time, it won’t do it, even if the versions are “portable” and totally independent. Note that I’ve only tried with “single instance” mode, if that makes sense (maybe it doesn’t). :)
-
I just tried a couple of different “portable” versions using the
-multiInst
command-line option on each; worked fine so I can’t recall exactly why I had trouble with this in the past. Sometimes a question posted here prompts thinking about things long set in your mind, and a new solution to an old “problem” bubbles up. :) -
@Meta-Chuh that’s a very interesting approach, will try this, although I honestly don’t know why notepad++ doesn’t have any way to open a new temp file without losing a session on start up as most software you find.