Is there a way to invoke equivalent of this special Explorer-specific menu item via the command line or an API call?
Note – I do not want to use workaround via taskkill, because I suppose this special restart action is different from killing the task and launching the EXE again.
My goal is to have a programmatic way to resolve issues when Windows Explorer becomes unstable or stops responding. (But even in these cases, this Restart action works normally.)
For skeptics: (answers moved here from comments)
I care about restart of Windows Explorer made as gracefully as possible. Currently, it hangs if Windows receives some keys from USB HID page 6.
I write apps and know apps. The higher attention is given to the app quality and importance, the softer landing is built into it. For example, the app itself can send its thread a request to stop. The thread listens to these requests and stops. Much better than need to kill an entire app. I suppose this best practice is also part of Windows core apps.
Windows Explorer works with Registry database and file system, performing writes there. It is always better to stop such apps more carefully than for example plain dumb find.exe which does not do anything like that.
