Nowadays Windows has a “restore session” feature in Notepad that mostly works, but if you restart your computer it may or may not restore your files properly. In case that happens, here's a way you might be able to get those unsaved .txt files back.
IMPORTANT NOTE: I am not a tech-guru and I didn't figure any of this out myself. I searched the web for help and this is what I learned from a Reddit thread. It worked, but it wasn't 100% clear if you're not a tech-guru so I decided to write it out clearly for folks who needed it.
Windows saves the temp Notepad save state things to the following location:
“C:\Users\[yourname]\AppData\Local\Packages\Microsoft.WindowsNotepad_8wekyb3d8bbwe\LocalState\TabState”
Go there and see if there's files from recent dates. If so, yay! You can maybe get them back.
This is a thing that can process the .bin files and (hopefully) turn them back into readable text.
Download it here: https://github.com/ogmini/Notepad-State-Library
I downloaded the regular standalone version.
It'll generate some .csv files that look like this:
NoFileTabs.csv will have the unsaved Notepad tabs in there. Open it with something like LibreOffice Calc.
At first the spreadsheet looks crazy, but don't freak out! Scroll over until you find the column labeled “ContentString.”
This'll have the decoded text in it! Then you can just copy-paste that into a new .txt file– and save it properly.
Download a notepad program that does auto-saves, like Notepad++.