Advertisement
Wasif_Hasan_

Refresh-Explorer (Powershell Function)

Sep 10th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function Refresh-Explorer {
  2.   [CmdletBinding()]
  3.   $open_folders = @()
  4.   $shell = New-Object -ComObject Shell.Application
  5.   $shell.Windows() | Foreach {
  6.     $open_folders += $_.LocationURL
  7.   }
  8.   taskkill /f /fi "status eq not responding" >$null
  9.   Stop-Process -Name explorer -Force
  10.   explorer.exe
  11.   $open_folders | foreach {
  12.     explorer $_
  13.   }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement