Restoring open software after a restart event in windows

36

13

I find that at the end of a long day, I sometimes have a large number of programs running. All which I will need to use tomorrow. Normally, this isn't an issue, I can simply lock the machine and come back tomorrow. My problem arrises when windows update launches in the middle of the night and force restarts my computer. That in turns closes all my open software. I of course save everything regularly so I don't loose anything, but I waste time reopening all of those resources whenever there is a restart.

[EDIT]

I should clarify that I still want to be able to restart my computer when an update comes down. Preventing the restart only delays the problem until later. I should have been more specific in that I want to be able to recover my working environment after a restart for any reason. Things like scheduled maintence, power loss, updates, and software installs.

[EDIT]

I can't simply have them setup to launch at startup becasuse those files change from week to week. So I need something that monitors what I have open, and gives me the option to "recover" those software sessions when I log back in.

Anyone have any suggestions on what I can do? I'd even be willing to purchase software to do this for me if that is the only option.

Thanks

Doltknuckle

Posted 2010-01-12T17:07:40.970

Reputation: 5 813

1the shutdown command doesn't really work as hoped... what I really need is a way to monitor currently open files. Then I can just build a dynamic script to re-launch those files. – Doltknuckle – 2010-01-22T16:28:40.800

16 years later and this is still not a Windows feature... OSX has had this for years! – GiH – 2016-03-31T06:42:55.377

7 years and counting..... – iAmLearning – 2017-09-20T10:59:26.220

Actually, I remember reading somewhere, that Win7 was supposed to have a feature something like this, though I guess they were unable to get it ready in time for release. So it may be coming in the future. – eidylon – 2010-01-12T18:53:06.420

1The "shutdown /g" command looks like it can be coupled with a program's automatic crash recovery feature to do 75% of what I am looking for. I'll have to do more testing to see if this works. – Doltknuckle – 2010-01-14T15:26:47.547

Answers

16

It is so annoying that there still isn't an elegant solution to this problem!

It happens to us all: Windows just slows down to a grinding halt (some sort of memory leak is causing it, as you're a typical 132 tabs open in chrome, 57 open in firefox, 24 windows open in total, doing a complex operation involving them all at the same time as you do job on top of job, on top of job.....kind of guy), and it gets so slow that you actually start wasting time just waiting for things to happen on your computer.....so you simply HAVE to reset your session that's been slowly building up over the past 5 weeks, and finally succumb to the nightmare that is recreating your intricate mess of windows and opened files and explorer folders, after the dreaded windows restart.

WELL.

I've spent a lot of time searching for elegant solutions that don't make it a nightmare, and, this is my conclusion and my current 'solution'.

Only one program have I found, that can save and restore both the programs AND the files that they had open - and it's really smooth, mostly. It's Twinsplay (Professional Edition). (CacheMyWork and SmartClose both only restore the programs, but not the files.)

However Twinsplay has some real problems and caveats (and also it's not freeware it costs $40):

  1. When restoring firefox, it seems to duplicate ALL the tabs inside, it must be coded to note what you had loaded inside firefox (as if each tab is a 'file' like how it will faithfully restore all your word files), so if you already have firefox set to open the tabs from previous session and had 100 tabs open it's going to try to load 200 tabs and generally be a disaster. Also, it messes the tabs out of order!! (thankfully it still at least keep the duplicate tabs in its own 'group' starting after the last one of the original tabs, but both tab groups have the order mucked up so yes it messes your original tabs' order too). This same problem I'm sure would happen in Chrome.....I didn't test it (I didn't dare!).

  2. The other problem: for any programs that you might commonly have multiple files open (like Word, Photoshop, InDesign): if for some reason a dialog box comes up during the first file's loading into the program (a macro error, or like in my InDesign, I had a missing image link in the first document), then all documents after that first one fail to open because Twinsplay by design loads all all files into their programs at once. And Twinsplay doesn't show anywhere in its UI a list of files from the saved session (nor in the Appdata logs/config files, I checked), so if this scenario happens you'll probably forget about that fifth file in InDesign that you were working on 4 weeks ago and still need to finish off!

SO: the method I'm doing after all this then, is:

I go through each file open in the taskbar, copy its file path (which is easy enough to do fairly quickly if you know your way around windows dialogs and menus and keyboard shortcuts), and for any file or window where I was in a particular spot or had certain things highlighted etc, I just note that down so I don't forget 10 minutes later. Here's a dummy example of what I mean.

Then after I restart, I just paste each file's path into windows explorer address bar to open each file one at a time, with its associated program. If I had a file was not actually open in its associated program (like a TIFF in Photoshop), I guess I'd note that down so I remember.

--

NOW. My solution is not too bad, but it still takes some time to copy the file path of every file open.

The ideal thing would be to have a tool that spits out ALL windows' file paths and program paths ("C:\photoshop.exe" "C:\image.TIFF") at once and then you can put that info into batch scripts to open each file with the program it was in, one by one, or all at once in the same batch if you want. That would be perfect.

To speed things up, is there some way to copy the file paths of ALL active windows' opened files?A little tool to spit out file paths of all current taskbar items should be pretty easy! If Twinsplay can do it, obviously it can be done somehow.....I've asked this question on a separate post, here. Could this code do it?

Since Microsoft hasn't provided us with an elegant OS-level one-click solution, we shouldn't attempt a holy grail hibernate-like session restore method with mere 3rd party access or e.g. tinker with hibernate cache reloading hacks etc.

Restarting windows is SUPPOSED to be a refresh to clear RAM and flush everything out, not retaining it all, so it's best done as a manual re-open of your files (while noting down a few details of where in certain files you were up to), but THIS as elegantly as possible.

user78017

Posted 2010-01-12T17:07:40.970

Reputation:

4I will add: Windows has something built in which it uses to reboot after certain updates are installed and a reboot is forced, and it will restore many/most of the windows to their original state. So, there is some OS level mechanism for this, not sure what it is nor how accessible it would be for us to use. – boomhauer – 2014-08-28T15:11:25.997

1

@boomhauer Registering for Application Restart notes that applications that "[Register] for application restart will also cause Windows to automatically restart the application after the computer is restarted... due to a software update."

– FriendlyGuy – 2014-12-29T21:28:41.037

Using Twinsplay is probably the best option that I have at this point. It'll work for most users and seems to be a great tool. The real solution to this is to change the user's behavior so they stop having these problems. – Doltknuckle – 2012-03-22T21:24:26.180

to solve the 'bugs' in twinsplay, like i said before the best by far solution i think would be to have a one-click batch file/tiny exe to copy all open files' paths and the programs they're in, then you can configure things to almost be only one more single click to restore after restart as well. annoying though that I seem to have asked my question about it in an unclear way so a mod closed the question :(.

– None – 2012-03-23T01:21:06.513

6

I've heard people use a program called CacheMyWork. It will reopen the apps you had open, but it won't open the files you working on (unless the program has such a feature).

Another option is you could sidestep the problem you can run your apps in a virtual machine. Then when you go home you can pause the virtual machine with will persist the state of the virtual machine to disk. Then resume the virtual machine when you return. This sidesteps the issue because someday you will need to update/patch the virtual machine's OS. Also, you will probably take a performance hit (how big depends on what you do).

When it comes to leaving things open and machines rebooting from patches, I'm right there with you.

Scott McClenning

Posted 2010-01-12T17:07:40.970

Reputation: 3 519

1The software suggestion is a step in the right direction. I think the problem is that it doesn't actively monitor open files so it can't restore them later. At worst, I may have to hack together a script that detects what files are open and then sets them up to launch in order. – Doltknuckle – 2010-01-13T03:09:59.327

1I agree, I wish CacheMyWork monitored the documents opened (like Windows Recent Docuemtns) and would rerun the documents at boot. Just like double clicking a Microsoft Word document will trigger Word, CacheMyWork could go a long way by running at boot my documents. – Scott McClenning – 2010-01-13T17:55:09.637

4

2016 and still nothing from Microsoft... I decided to give it a try with vbscript. It's not great, but it does fire all programs back up and in some cases even it's windows.

The first script saves all processes to a text file in the specified folder (desktop) and all window names to a separate file. The second script reads and launches all processes from the file written by the first script. Both should be saved with extension .vbs. Also, the saving of window names requires Microsoft Word to be installed (Don't ask..).

On Error Resume Next
Dim session, folder, Word, Tasks

Set Word = CreateObject("Word.Application")
Set Tasks = Word.Tasks

' folder is the folder in which the files will be created. Can also be instantiated by hardcoding a path
folder = getPathOfFolder("Desktop")
' The second argument of the function call (session.txt) is the filename of the file containing all window names
Set sessionFile = CreateFileAt(folder, "session.txt")

for Each Task in Tasks
    if Task.Visible Then
        sessionFile.WriteLine(Task.Name)
    End if
Next
sessionFile.Close
Word.Quit

' The second argument of the function call (processes.txt) is the filename of the file containing all processes
Set processesFile = CreateFileAt(folder, "processes.txt")
set processesList = getAllProcesses()

for Each Process in processesList
    processesFile.WriteLine(Process.CommandLine & "")
Next

processesFile.Close
MsgBox("Done!")




Function getPathOfFolder(path)
    ' Dim objShell As Object
    ' Dim strPath As String

    Set objShell = Wscript.CreateObject("Wscript.Shell")
    Path = objShell.SpecialFolders(path)
    getPathOfFolder = Path & "\"
End Function

Function CreateFileAt(filePath, fileName)
    Dim fso, session
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set session = fso.CreateTextFile(filePath & fileName, true)
    Set CreateFileAt = session
End Function

Function getAllProcesses()
    Const Computer = "." 
    Dim WMI, ProcessList
    Set WMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2")
    Query = "Select * FROM Win32_Process"
    Set ProcessList = WMI.ExecQuery(Query)
    Set getAllProcesses = ProcessList
End Function

.

On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile(getPathOfFolder("Desktop") & "processes.txt", 1)

Do While file.AtEndOfStream = False
    Set Shell = CreateObject("Wscript.Shell")
    Shell.Run(file.ReadLine)
Loop

MsgBox("Done!")

Function getPathOfFolder(path)
    ' Dim objShell As Object
    ' Dim strPath As String

    Set objShell = Wscript.CreateObject("Wscript.Shell")
    Path = objShell.SpecialFolders(path)
    getPathOfFolder = Path & "\"
End Function

I haven't yet found a way to programmatically get the file paths user78017 copies everytime he restarts. I'd like to hear for what programs this script opens all open files back up and for what programs it doesn't. If anyone feels like cleaning this code, feel free to edit the post.

Fr4nc3sc0NL

Posted 2010-01-12T17:07:40.970

Reputation: 41

1

Got this one on the RSS feed today:

CacheMyWork is a handy utility that enables you to reboot Windows without losing your place in your work. It builds a checklist of currently open applications, and will restart the apps you've selected the next time you logon to the computer.

Source

Steiv

Posted 2010-01-12T17:07:40.970

Reputation: 478

+1 Ha, that's cute ... very nice find (but it had already been posted by Scott). – None – 2010-01-21T22:31:30.430

0

I have the same problem. After a reboot, I have at least a half hour restart of all of the processes that I normally use.
I've found one utility that has the capability of returning to the pre-boot status, Slimbrowser. I would dearly love more.

Dave

Posted 2010-01-12T17:07:40.970

Reputation: 526

1I've found ways to save browser (use firefox) and folder (windows setting) sessions and have them relaunch on startup. The other things like Office (Word,Excel,Outlook), notepad, and adobe reader I have yet to find a good solution for. – Doltknuckle – 2010-01-12T18:30:08.010

For an editor, ultra-edit has that capability. I personally prefer kedit because of it's scripting capabilities. – Dave – 2010-01-12T20:41:29.917

-1

Not exactly what you asked, but you could simply put your computer in "suspend" mode overnight. Unless you actually have processes running, this won't change anything about how it works, it will only take a second or two to unsuspend in the morning, and Windows Update can't run during suspension.

And it's free.

CarlF

Posted 2010-01-12T17:07:40.970

Reputation: 8 576

What Doltknuckle is asking is "How do I restore the stuff I was working on after a restart?" The question people keep answering, however, is "How do I prevent my computer from automatically restarting?" The latter is a good question, but it is completely irrelevant to the question that was actually asked. – Martha – 2010-01-22T15:33:15.980

Nice idea, but doesn't solve the problem when the OP has to do a Windows update though. – ChrisF – 2010-01-12T17:21:21.880

1I have thought of that, suspension and hibernation really don't do anything for me. It's not that I want to save energy, it's mainly that I want to get back to my previous work environment after a hard restart. – Doltknuckle – 2010-01-12T17:24:18.970

My thought was that if you were there, you could just refuse to reboot until convenient. – CarlF – 2010-01-12T18:44:33.897