Is there a way to restart all instances of Windows Explorer? It's useful when explorer starts acting up, eg. high cpu .
Asked
Active
Viewed 831 times
0
-
Explorer never "acts up" regarding CPU. Your computer may be infected. – harrymc Sep 19 '20 at 08:24
-
1Does this answer your question? [How can I remove malicious spyware, malware, adware, viruses, trojans or rootkits from my PC?](https://superuser.com/questions/100360/how-can-i-remove-malicious-spyware-malware-adware-viruses-trojans-or-rootkit) – harrymc Sep 19 '20 at 08:24
-
thanks for the suggestion. it's more my antivirus hogging resources. – tinker Sep 21 '20 at 03:50
-
Which antivirus? And what does Explorer have to do with the antivirus? – harrymc Sep 21 '20 at 05:40
3 Answers
2
; Ctrl F9 - restarts all windows explorer.
^F9::
Runwait TASKKILL /F /IM explorer.exe
Run explorer.exe
return
Runwait will wait for the command to complete before going to the next line. This is required, else Run explorer.exe might run too soon, and get killed as well.
tinker
- 260
- 2
- 12
1
I have designed a better one using powershell:
$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 $_
}
It will open the folders which were open before restarting of explorer and kill not responding processes before explorer restart.
Wasif
- 7,984
- 2
- 19
- 32
1
; Get a list of all opened explorer windows:
If WinExist("ahk_class CabinetWClass") ; explorer
{
list := ""
; https://autohotkey.com/boards/viewtopic.php?p=28751#p28751
for window in ComObjCreate("Shell.Application").Windows
{
explorer_path := ""
try explorer_path := window.Document.Folder.Self.Path
list .= explorer_path ? explorer_path "`n" : ""
}
list := trim(list, "`n")
}
; MsgBox, %list%
RunWait, %comspec% /c taskkill /f /im explorer.exe ,,hide
Process, WaitClose, explorer.exe
; We can now restart the Explorer.exe Process:
Run, explorer.exe
; open all explorer windows we had open previously:
If (list != "")
{
Process, wait, explorer.exe
Loop, parse, list, `n
Run %A_LoopField%
}
user3419297
- 3,370
- 2
- 11
- 11
-
-
the script is erroring out at last 3 lines, putting double quotes on the "n" fixes it. >>> Loop, parse, list, "`n" – tinker Sep 03 '21 at 07:53