Sep-14-2020, 04:34 PM
I'm trying to successfully restart Explorer.exe (Windows 10) via Python 3.x. I'm using the subprocess module and it's
* I always terminate explorer.exe via "taskkill /im explorer.exe /f". So throughout this post, that is how I do it.
* Restarting the process is trivial. I kill explorer, followed by calling "<path>\explorer.exe". Terminating explorer is fine and dandy, but restarting it through this method halts the calling script after the line to launch it.
* Terminating explorer.exe, followed by restarting it via calling "start explorer.exe" does not halt the script, but the behavior is not right. Doing it this way just launches a window/folder, the desktop is not restored. The script proceeds, however.
* Now on the Windows command line, terminating explorer and launching it via "start" works fine. The desktop is restored.
So, does anyone have experience restarting explorer, or any ideas how to make the
run()
function. Here's what I've observed:* I always terminate explorer.exe via "taskkill /im explorer.exe /f". So throughout this post, that is how I do it.
* Restarting the process is trivial. I kill explorer, followed by calling "<path>\explorer.exe". Terminating explorer is fine and dandy, but restarting it through this method halts the calling script after the line to launch it.
* Terminating explorer.exe, followed by restarting it via calling "start explorer.exe" does not halt the script, but the behavior is not right. Doing it this way just launches a window/folder, the desktop is not restored. The script proceeds, however.
* Now on the Windows command line, terminating explorer and launching it via "start" works fine. The desktop is restored.
So, does anyone have experience restarting explorer, or any ideas how to make the
run()
call behave exactly as if I killed explorer via the command prompt? I need to restart explorer and have the script continue to process. There's something different about calling a command via run()
, but I wonder if it can be fixed with an argument or combination of arguments.