How to disable Notepad++ Auto-open previous files without opening Notepad++?

13,953

Solution 1

Yes, you can change that setting by modifying the config file.

go to %appdata%\Notepad++ and open config.xml

You should find the following line in there:

<GUIConfig name="RememberLastSession">yes</GUIConfig>

just change it to no and that should do the trick.

Solution 2

Start from command line:

notepad++ -nosession

"Auto-open previous files" then should be disabled

Solution 3

This is for those who do not want to modify the XML config filess, and this will also work without having the Notepad++ in PATH.

As I do not have enough reputation to comment on other answers, I'll add on Jacques Hubart's comment, all credits should still be for him.

  1. Open Windows Run (Windows + R)
  2. Type in the full path to the Notepad++ EXE. This would normally be C:\Program Files\Notepad++\notepad++.exe
  3. Add the nosession parameter
  4. Run

Preview:

Run Preview

Solution 4

If, like me, you left a huge file in the last session, you can also remove just the offending file from the session and keep the rest.

go to %appdata%\Notepad++ and open session.xml

Scroll to the right to see the filename. Be careful to keep the integrety of the XML by removing the entire "file" node. It should be on a single line.

Share:
13,953
cytsunny
Author by

cytsunny

Stay hungry, stay foolish. And this photo will at least help me achieve the first half..... or the second half too if you think this is foolish.

Updated on June 13, 2022

Comments

  • cytsunny
    cytsunny about 2 years

    How do I stop Notepad++ from loading all files from the past session?

    I know how to do that settings in Notepad++, but the problem is that I once opened a very large file (>10GB) and made the Notepad++ hang up. Notepad++ has already marked that big file in the session and therefore hang up everytime I start the Notepad++. Is there a way I can stop it from loading the past session so it won't hang up every time?

    P.S. I have received a report on possible duplicate with this question. This is obviously a different case. At least in that question the notepad++ still starts up normally while in my case I cannot even change the settings normally because the notepad++ just hang while loading the stored version. The answer to this question also provide a good way to change the settings without starting Notepad++, which will be useful in fixing problems caused by settings when the Notepad++ cannot starts normally.