What is the cleanest way to programmatically kill and restart explorer.exe?

Greetings to all

I am working on a Windows program whose installation requires a restart of explorer.exe. I know that “restarting the computer to complete the installation” is the standard method here, but I want my installer to give users the option to simply restart the explorer so that they can immediately start using my program. What is the best way to do this? Of course, I could just find and kill the process, but it seems rather unpleasant. Is there any trick, say, to make Explorer think that the user is logging out and closing cleanly?

Thank!

+3
source share
5 answers

Is this an MSI installation?

Have you considered using Restart Manager ?

Restart Manager will detect which processes store files / descriptors, open and need to be restarted, and allow them to automatically stop / start these processes without rebooting.

+2
source

I can try calling ExitProcess or TerminateProcess to stop explorer.exe.

+1
source

, , PsTools :

http://technet.microsoft.com/en-us/sysinternals/bb896649

, , explorer.exe:

pskill explorer.exe
psexec -d explorer.exe
exit

PSTools TechNet.

+1

WM_ENDSESSION.

, . , ..

, , .

0

powershell , :

get-process explorer | kill

0

Source: https://habr.com/ru/post/1745405/


All Articles