How to launch Notepad++ with new document open
-
@Roman-Revell said in How to launch Notepad++ with new document open:
but I can’t figure out what command would bring it up and open a new document. Is there any way to do this?
I would think the commandline option “-nosession”. Just look under
?
on the main menu, then Command Line Arguments.Bear in mind that your use of the word document isn’t really correct. These are just tabs and aren’t real files unless you save them as such.
Terry
-
The term “document” is totally valid terminology within Notepad++. We have Find All in Current Document, Find All in All Opened Documents, Close Mutliple Documents, Close All but Active Document, and maybe more.
Tab (contents) are “documents”, whether they are saved or unsaved, to disk. I don’t know that OP in his phraseology even made the distinction between saved/unsaved.
-
whether notepad++ is running or not
Probably Terry’s suggestion of
-nosession
added to your batch file would take care of the case where you are starting N++ from a “not previously running state”. However, I don’t think it will cause it to do what you want if invoked when N++ is already running. -
@Terry-R said in How to launch Notepad++ with new document open:
-nosession
Thank you for your reply.
Yes, -nosession works to prevent previous tabs from coming up; so, if Notepad++ isn’t running already when I launch it, that effectively works. But if it is running, that does nothing.This
“C:\Program Files\Notepad++\notepad++.exe” -nosession -multiInst
does open a new session without any tabs even if Notepad++ is already running. So, I guess that almost does it. That might be good enough for me. -
“C:\Program Files\Notepad++\notepad++.exe” -nosession -multiInst
What advantage have you managed to create with that, with your driving need to have a “new document” open when you startup N++?
OK, so, you have that in a batch file, and you type
go_npp
(or whatever your bat file is named) while your CMD prompt is in some arbitrary directory. N++ opens up and you are looking at a blanknew 1
document. Now what?Maybe you make some changes to
new 1
and want to save them intotest.txt
. By virtue of having a “current directory” (where your CMD prompt was sitting when you ran the bat file), doing a Save will invoke a SaveAs prompt window in that folder, so that’s nice and convenient…But, why not invoke your batch file the following way, and save a step?:
go_npp test.txt
. N++ will prompt you to createtest.txt
before its main window appears, but other than that, this workflow seems more efficient to me. (Note that you’d have to add a%1
or a"%1"
on your batch file line that runs the exe.) -
@Alan-Kilborn
I could do that sometimes if appropriate. I have not had success getting that to work really, but haven’t tried much. But, my goal is to just have Notepad++ open so that I can paste some text or start typing. Opening in a new document saves me from also having to do ctrl+n or click the icon. Just a little more convenient as long as I’m already running a command or script, might as well have it do what I want. -
…so that I can paste some text or start typing.
Sounds wishy-washy.
People often do this so they don’t have to name/save their tab (“I’m just taking a quick note”).
They quit N++ and their “note” is there next time – all is good.In your case, by starting with
-nosession
, you won’t get this behavior – you’ll get prompted to save thenew 1
file when you exit the instance. Easier to just specify the filename you’re going to end up with, up front. Unless your data is complete throwaway, each and every time (dubious).So really, I’m still baffled at why you want the behavior you do.
But, you go ahead being you, wanting what you want…
I just thought there might be something for others to take away from what you’re doing; I don’t think there is. -
@Alan-Kilborn
I’m not sure why you seem so offended by the fact that I hit WindowsKey+R, type npp enter, get a window, and then paste text that I have on the clipboard. That’s easiest for me. It’s not wishy washy at all. Not everyone does the same work in the world of computers. But you accidentally helped me anyway. So, thanks. -
@Roman-Revell said in How to launch Notepad++ with new document open:
offended
Don’t mistake spirited debate for offense.
This site is here for discussion of Notepad++ usage, after all.
Like I implied, I’m always looking for new tips-n-tricks to improve my own usage – just because I didn’t find that here doesn’t make me offended.
Cheers! -
@Roman-Revell said in How to launch Notepad++ with new document open:
But, my goal is to just have Notepad++ open so that I can paste some text or start typing. Opening in a new document saves me from also having to do ctrl+n or click the icon. Just a little more convenient as long as I’m already running a command or script, might as well have it do what I want.
Create a file called “scratchpad.txt”. Have your batch file open notepad++ with that same scratchpad file every time you run that shortcut. QED.
Or, better, pin a shortcut to your taskbar that opens notepad++ with that file, so you don’t even have to Win+R and type
npp[ENTER]
. QED.Or, better, always have a copy of Notepad++ running, with your scratchpad file always open. You can even put in your windows startup so it happens with you never having to manually run Notepad++. QED.