From ff7d58861475499bdc0726590ea75174717e7b9a Mon Sep 17 00:00:00 2001 From: yatharth182002 <53784295+yatharth182002@users.noreply.github.com> Date: Thu, 20 Nov 2025 12:11:30 +0530 Subject: [PATCH] Change the restart logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace each instance of subprocess.Popen('explorer.exe') with a start call through cmd.exe. For example: import subprocess # Kill existing explorer subprocess.run(['taskkill', '/F', '/IM', 'explorer.exe'], check=True) # Use cmd’s ‘start’ to relaunch the Explorer shell subprocess.run(['cmd', '/c', 'start', '', 'explorer.exe'], check=True) --- FadCrypt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FadCrypt.py b/FadCrypt.py index f383cbd..c745f51 100644 --- a/FadCrypt.py +++ b/FadCrypt.py @@ -224,7 +224,7 @@ def safe_flush(stream=None): with open(log_file, 'a') as f: f.write("[REGISTER-CONTEXT] Restarting Explorer...\n") try: - subprocess.run(['taskkill', '/f', '/im', 'explorer.exe'], + subprocess.run(['cmd', '/c', 'start', '', 'explorer.exe'], stderr=subprocess.DEVNULL, timeout=5) subprocess.Popen('explorer.exe') print("[CONTEXT MENU] Explorer restarted successfully", flush=True) @@ -314,7 +314,7 @@ def safe_flush(stream=None): with open(log_file, 'a') as f: f.write("[UNREGISTER-CONTEXT] Restarting Explorer...\n") try: - subprocess.run(['taskkill', '/f', '/im', 'explorer.exe'], + subprocess.run(['cmd', '/c', 'start', '', 'explorer.exe'], stderr=subprocess.DEVNULL, timeout=5) subprocess.Popen('explorer.exe') print("[CONTEXT MENU] Explorer restarted successfully", flush=True) @@ -368,7 +368,7 @@ def safe_flush(stream=None): with open(log_file, 'a') as f: f.write("[REGISTER-CONTEXT] Restarting Explorer...\n") try: - subprocess.run(['taskkill', '/f', '/im', 'explorer.exe'], + subprocess.run(['cmd', '/c', 'start', '', 'explorer.exe'], stderr=subprocess.DEVNULL, timeout=5) subprocess.Popen('explorer.exe') print("[CONTEXT MENU] Explorer restarted successfully", flush=True) @@ -901,7 +901,7 @@ def safe_flush(stream=None): print("[CLEANUP] Restarting File Explorer to clear context menu cache...", flush=True) try: # Kill explorer and restart it properly - subprocess.run(['taskkill.exe', '/f', '/im', 'explorer.exe'], + subprocess.run(['cmd', '/c', 'start', '', 'explorer.exe'], capture_output=True, timeout=5) # Give it a moment to fully terminate import time