Restoring open software after a restart event in windows

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.


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.


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.

Tags:

Windows

Reboot