Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There have been a handful of times when my Windows 2000 and XP machines have unexpectedly shutdown due to either a Windows crash or a power outage which causes my UPS to automatically shutdown the computer.

I'm a person who frequently has a lot of programs open, and I often go weeks or even months without restarting the computer, so it can be very difficult to remember what programs I had open and everything I was working on if the computer shuts down unexpectedly. In addition, I sometimes open instances of Notepad to jot down reminders or little to-do lists. Those obviously get lost in an unexpected shutdown.

Is there any software (commercial or free) that can remember all the windows (and their titlebars) that I had open prior to the shutdown? Also, if the software can save the contents of Notepad windows, that'd be great too, although I'm not sure that's possible.

share|improve this question
Use something else besides Notepad to store tasks, or there are a lot online storage websites with sync'ing (dropbox,gmail docs... a ton of them and mostly free for small demands). The other demand you have sounds like you better get a better UPS if it shuts down everytime you lose power (unless you lose power for really a long time). – Logman Aug 24 '12 at 23:36
Some UPSs come with software that will make your computer hibernate when power is lost rather than shut it down immediately. This will save all your open applications and associated files. – martineau Aug 25 '12 at 0:10
Instead of Notepad use something like Open Office. – Daniel R Hicks Aug 25 '12 at 1:51
It might be possible to generate a list of programs and files that are currently open, and use that list to generate a shell script that re-launches the programs at startup. See here:… – Anderson Green Feb 22 '13 at 19:36

unexpected shutdown

A few points:


If 100% reliability is needed, this is not possible. It's a "race condition". There is currently no way to atomically open a window while simultaneously syncing the existence of that window to the filesystem. Imagine this sequence of events, in chronological order from earlier to later:

  1. You open an application, or an application opens a new window.
  2. The Windows API provides notification to the "monitoring program" telling it about the existence of a window.
  3. Power is cut before the "monitoring program" is able to write the fact that the window is there to "persistent storage"; that is, the hard drive.

Application Knowledge

In the general case, no third-party program can know the reason why a program has opened a given window. At a programming level, a program can decide to open a new window for any reason at all, or for no reason. Given this fact, the third-party program cannot know what steps are necessary to cause the window-opening program to open new windows.

For specific applications, this can be done. For example, for Microsoft Word, there are ways to read window titles and infer the names of open documents, or even install a Word Add-In that monitors the open windows and keeps track of open documents, then re-opens them on reboot.

However, when looking for such a solution, you would have to make sure that the "monitoring program" is able to understand the windowing strategy of each application you want to automatically re-open, and also understand the process for asking that application to re-open all of those windows.

One "naive" way to approach this would be to keep track of all the running programs that have created one or more windows, and then "stupidly" launch those executables when you restart your computer. It would be fairly simple to write such a program, and in fact, I'm sure many such programs exist. The downside is that it's probably not that useful -- how useful to you would it be if notepad.exe launched when you started Windows, with no document open? That is basically the extent of what you can do in "the general case".

Data Integrity

If you're in the middle of editing a document in Notepad or Word or any other editor program, and your PC suddenly shuts off, there is no reliable way to retain all of your data. If you are hoping for a software solution for this, keep hoping. It's better to buy an Uninterruptible Power Source (UPS), which is basically a big battery attached to your PC that prevents your PC from losing power if the main electricity is brought down or temporarily faults. Typically a UPS can keep your PC running long enough for you to save your work and shut down.

There is one way, in principle, to get better data integrity, but it is an implementation detail of a text / document editor: if the editor writes your changes to disk every single time you type a character or make a change, then the most data you can lose is one character (you typed the character and it couldn't get out to disk before you lost power). The way most editors work today, however, you may lose several minutes worth of data (in the case of AutoSave), or all of your data (in the case of editors without AutoSave).

I Don't Give Software Recommendations ;)

Something that "just keeps track of which files you have open in Notepad" is doable, but it's probably even easier to use a real text editor that remembers which files you have open without third-party plugins, such as Notepad++.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .