1

Sometimes I have to restart explorer.exe, but I often have many folders open, that get closed in the process. How can I still have these folders open after restarting explorer.exe? I was also thinking about writing a script to get a list of currently open folders, but couldn't find out how to do that either.

1 Answers1

1

Use this powershell code for this:

$open_folders = @()
$shell = New-Object -ComObject Shell.Application
$shell.Windows() | Foreach {
  $open_folders += $_.LocationURL
}
taskkill /f /fi "status eq not responding" >$null
Stop-Process -Name explorer -Force
explorer.exe
$open_folders | foreach {
  Invoke-Item $_
}

This uses Shell.application to list and restore open folders and kills not responding processes.

wasif
  • 9,176