2

How can I Restore previous folder windows after restarting explorer.exe? I thought about saving the current folder position/folder path and retrieve/open it after the explorer restart? For example, if:

  1. “Drive/Work/Receipts” and “Drive/Private/Random” folder paths were opened in file explorer.
  2. save all these folder paths to a file.
  3. restart explorer.exe using stop-process -name explorer –force.
  4. open all the folder paths in the file.
music2myear
  • 49,799

1 Answers1

3

I've written PowerShell code to save and restore most aspects of Explorer windows including:

  • Location (full shell namespace path)
  • Window size, position, and state (including FullScreen)
  • a subset of view settings including:
    • Icon mode (Tiles, Details, etc.)
    • Icon size
    • Sort column(s) and direction
    • GroupBy state
    • FolderFlags
  • Search specifications (for SearchResults folder)

Settings are saved to a custom object that can optionally be exported and saved to a file for future/repeated use of a desired layout.

The module exposes two advanced funcdtions:

PS > get-help *ExplorerWindow | ft -AutoSize -Wrap

Name Category Module Synopsis


Get-ExplorerWindow Function SaveRestoreExplorerWindow Captures the state of open Explorer windows, creating a custom object for each open window. Restore-ExplorerWindow Function SaveRestoreExplorerWindow Opens an Explorer window to a previously captured state.

You can peruse the help files or simply browse the output of ``Get-ExplorerWindow` to get statred...

PS keith> Get-ExplorerWindow

Title : Quick access IsControlPanel : False Filter : ItemPath : ::{679F85CB-0220-4080-B29B-5540CC05AAB6} NameSpacePath : Quick access OpenByNSPath : False ViewState : @{CurrentViewMode=Tiles; IconSize=48; SortColumns=prop:System.Home.SortOrder;System.ItemNameDisplay;; GroupBy=System.Home.Grouping; FolderFlags=AutoArrange, BesTfitWindow, NoHeaderInAllViews, UseSearchFolder} WinState : @{TheaterMode=False; ShowCmd2=; WP=WINDOWPLACEMENT}

Title : Windows PowerShell Script IsControlPanel : False Filter : ItemPath : C:\Users\keith\AppData\Roaming\Microsoft\Windows\Libraries\Sandbox.library-ms&Window s PowerShell Script NameSpacePath : Libraries\Sandbox\Windows PowerShell Script OpenByNSPath : True ViewState : @{CurrentViewMode=Details; IconSize=16; SortColumns=prop:-System.DateModified;; GroupBy=System.Null; FolderFlags=AutoArrange, NoHeaderInAllViews, UseSearchFolder} WinState : @{TheaterMode=False; ShowCmd2=; WP=WINDOWPLACEMENT}

A .zip file with installation instructions can be downloaded here:

Keith Miller
  • 10,694
  • 1
  • 20
  • 35