5

I'm aware of the feature in Windows that will allow you to "restore previous folder windows at logon" because I'm already using it. When am working on a big project and have 10 million things going on at once, explorer might crash or I might have to forcefully restart explorer and then all the folders that I had open won't automatically reopen like they do if I restart Windows normally.

I need a way to backup/restore all my currently opened File Explorer folder windows. I've searched but found nothing.

At the very least, if there was a way to capture the paths to all the currently opened folders, then I could at least create a batch script to re-open all of them. But I don't know of a way to capture the paths of all the currently opened folders.

*I found a dos utility called "Handle" that will display information about open handles for any process in the system. I was able to create a batch script and using handle I am able to output a list of open folders that are currently open, however it's definitely far from ideal. I still then have to take that output and clean it, then create another script from it to then automate opening the folders.

I'm certain that someone must know of some utility that has already been created for this specific purpose.

1

3 Answers 3

4

When you run this, it will create a new batch file called "foldersession.bat" and when you run that, it will restore them.

@echo off
title create backup of currently open folder windows
setlocal enabledelayedexpansion

powershell  @^(^(New-Object -com shell.application^).Windows^(^)^).Document.Folder.Self.Path >> prevfolderpaths.txt

FOR /F "tokens=*" %%f IN (prevfolderpaths.txt) DO (

set "var=%%f"
set "firstletters=!var:~0,2!"

IF "!firstletters!" == "::" ( ECHO start /min shell:%%~f >> foldersession.bat) ELSE ( ECHO start /min "" "%%~f" >> foldersession.bat)

)

del "prevfolderpaths.txt"

Only problem with this, is that if you want to save multiple window sessions you will have to rename the files manually. (eg. foldersession1, foldersession2)

2

I would like to share a modification to the excellent proposal by @goldnick7. (It´s in fact a comment to his already accepted answer, but I will post it this way so I can share an image and formatted code).

This modification allows to have unlimited backup files with a unique name, without having to manually rename the output file every time. This way when you run the script it will concat the current date (in YYYYMMDDHHII format) to the file name. It also asks for an user input in case you want to concat a descriptive title/label at the end of the file name (not required, you can leave it empty).

Note: I've renamed the original script to "windows_explorer_save_session.bat" for personal naming criteria for batch scripts (I have hundreds that I use every day, I love them). The generated filenames have a similar format: "windows_explorer_restore_session_DATE_OPTIONALTITLE.bat"

enter image description here

Here´s the extended script:

@echo off 
title create backup of currently open folder windows 
setlocal enabledelayedexpansion

set /p "docTitle=Enter descriptive label (optional): " 
IF NOT "%docTitle%"=="" (   
    SET "docTitle=_%docTitle%" 
) 
FOR /F "tokens=1-6 delims=/: " %%G IN ("%DATE% %TIME%") DO (    
    SET "currentDate=%%I%%H%%G%%J%%K" 
) 
set "filename=windows_explorer_restore_session_%currentDate%%docTitle%.bat"    

powershell  @^(^(New-Object -com shell.application^).Windows^(^)^).Document.Folder.Self.Path >> prevfolderpaths.txt

FOR /F "tokens=*" %%f IN (prevfolderpaths.txt) DO (    
    set "var=%%f" 
    set "firstletters=!var:~0,2!"    
    IF "!firstletters!" == "::" ( ECHO start /min shell:%%~f >> %filename%) ELSE ( ECHO start /min "" "%%~f" >> %filename%)    
)    
del "prevfolderpaths.txt"
1
  • There's one issue with your code – the date format in CMD depends on the system locale and the date format can be customised to be whatever the user wants. Example output on my system: "%DATE% %TIME%"="2024-01-30 0:25:47.42" currentDate=2502024-01-3047.42 Why not use PowerShell Get-Date -Format to format a date string since the batch file already calls PowerShell to get Explorer windows?
    – AndyDeGroo
    Commented Jan 29 at 22:30
0

As an alternative to the answers above you could use QTTabBar (it is free), an extension to Windows Explorer, which can bookmark all open tabs by using the "Create a Group from All Tabs" function. Which later on can all be opened in a matter of few clicks.

As a paid alternative you could use Directory Opus (DOpus) file manager. For example if you have lost your tabs due to a crash in DOpus, there are a few steps you can try to recover them:

  1. First, restart DOpus and see if the tabs reappear. Sometimes, a crash may cause temporary issues that can be resolved by restarting the program.

  2. If restarting DOpus doesn't work, try using the "Reopen Last Listers" feature. To do this, go to the File menu and select "Exit Directory Opus". When prompted, select the "Reopen all listers that were open when the program was last closed" option. This should restore your tabs from the last session.

  3. If the above steps don't work, you can try restoring your tabs from a saved layout. To do this, go to the Settings menu and select "Lister Layouts". Choose the layout that you want to restore, and click the "Load" button.

If none of these methods work, it's possible that your tabs may have been lost permanently due to the crash. In this case, it's important to regularly save your work and create backups to prevent data loss in the future.

As a solution to the above paragraph you can use AutoVer to backup the file(s) (in case they don't use registries for storing bookmarks) that hold(s) the bookmarks data. This should apply for both QTTabBar and DOpus.

You must log in to answer this question.

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