Stop "explorer" process completely using PowerShell
Asked Answered
W

4

12

Greeting, I'm trying to stop "explorer" process using power-shell command:

Stop-Process -ProcessName explorer -Force

the problem with that line, it will stop the process but it will run again automatically so it just restarting the process not stopping it.

Please advice me how to stop "explorer" process completely using power-shell

Regards,

Wnw answered 22/12, 2011 at 22:14 Comment(0)
I
17

You can do this ( though I don't know why you wouldn't want explorer to come back):

taskkill /F /IM explorer.exe
Irradiate answered 22/12, 2011 at 22:18 Comment(2)
I wonder what the difference is... Looks like there is a registry key that controls the behavior of explorer.exe when it crashes unexpectedly AutoRestartShell.Burial
This answer can be problematic on servers. You may want to kill your own process to change some things before your profile is reloaded, but you may not want to affect other users. Which this will do.Patmos
A
8

Set the AutoRestartShell DWord value to 0 before you kill explorer

PS> Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name AutoRestartShell -Value 0
PS> Stop-Process -ProcessName explorer -Force
Amadus answered 23/12, 2011 at 14:47 Comment(1)
I didn't knew about that registry key, nice.Cryotherapy
T
1

Many years later but thanks for the quick tip.

just an FYI in case someone comes across this later like I did

In my case I don't want explorer to restart automatically because I want to reload the profile using:

Start-Process -ProcessName explorer -LoadUserProfile

OR load a new set of environment variables

Start-Process -ProcessName explorer -UseNewEnvironment

Cheers

Thoma answered 30/5, 2016 at 14:43 Comment(0)
B
0
Stop-Process -Name explorer -Force
Start-Sleep -Seconds 1.0
Stop-Process -Name explorer -Force 

This worked for me

Bostwick answered 15/3 at 8:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.