24

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.

Community
  • 1
  • 1
cytsunny
  • 4,838
  • 15
  • 62
  • 129
  • Possible duplicate of [Notepad ++ doesn't save document on exit?](http://stackoverflow.com/questions/24447786/notepad-doesnt-save-document-on-exit) – AdrianHHH Jul 21 '16 at 08:14

7 Answers7

20

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.

yzwijsen
  • 354
  • 2
  • 6
  • 6
    Thanks for pointing to that folder. Once within the folder, the alternative is to edit session.xml and remove the file that is making trouble. – Birgit Vera Schmidt Jun 26 '17 at 08:56
  • 1
    You should open config.xml with something else than Notepad++! Else it will just reset the config when you close the program. – Arno van Oordt Feb 23 '18 at 08:50
  • You can do the same in settings: Settings > Backup > Uncheck "Remember current session for next launch". – Yann Aug 25 '22 at 06:33
12

Start from command line:

notepad++ -nosession

"Auto-open previous files" then should be disabled

jordan
  • 3,436
  • 11
  • 44
  • 75
Jacques Houbart
  • 119
  • 1
  • 5
  • Although I guess that should work, when using windows, it is not a common practice to have PATH set to the position of notepad++. One may need to navigate to the notepad++ file path before using this command line. – cytsunny Feb 25 '19 at 07:22
  • I already had the problem of having a very large file that prevents to open normally notepad ++ I created at home a .lnk with this parameter to open notepad ++ cleanly – Jacques Houbart Feb 26 '19 at 18:48
6

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.

Bill Wilder
  • 61
  • 1
  • 2
  • This is also mentioned in the comment of the best answer. I guess it would be more meaningful if you can give an example of editing the XML? – cytsunny Dec 01 '20 at 03:53
5

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

Phragos
  • 65
  • 1
  • 5
-1

There is also another way from GUI In Settings/Preferences/Backup uncheck the "Remember current session for next launch"

Eliask
  • 7
  • 1
-1

As suggested use notepad++ -nosession from run to open notepad++. Then go to preferences --> Backup --> Uncheck Remember current session before next launch Close notepadd++ and open it normally without run. It worked for me.

swap
  • 11
-1

another possibility is that the window is on an other screen not visible anymore due to starting it in a new multimonitor setup.

in that case, you have to bring the windows in the visible area by:

  • select the window by Alt+Tab
  • Alt+Space opens a small menu in the top left corner
  • Arrow-Down and Enter selects ' Move'
  • Arrows brings it back
mischl
  • 33
  • 4
  • I was using one monitor only all the time, and I already saw the Notepad++ program opening up. I can see that in task manager. The problem was It just hung there and I had to kill the program with task manager. – cytsunny Sep 15 '22 at 12:51