From a3e4dc271a97fd1d84793db8e140e67693c5944b Mon Sep 17 00:00:00 2001 From: piotrj Date: Sat, 2 Mar 2024 21:46:53 +0100 Subject: [PATCH] CREATE_NO_WINDOW on lnk creation --- src/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core.py b/src/core.py index 048e6e3..7bd1784 100755 --- a/src/core.py +++ b/src/core.py @@ -42,6 +42,9 @@ from subprocess import run as subprocess_run +if os_name=='nt': + from subprocess import CREATE_NO_WINDOW + from pickle import dumps,loads from zstandard import ZstdCompressor,ZstdDecompressor @@ -827,7 +830,7 @@ def do_win_lnk_link(self,src,dest,l_info): powershell_cmd = f'$ol=(New-Object -ComObject WScript.Shell).CreateShortcut("{dest}")\n\r$ol.TargetPath="{src}"\n\r$ol.Save()' l_info(f'{powershell_cmd=}') - res = subprocess_run(["powershell", "-Command", powershell_cmd], capture_output=True) + res = subprocess_run(["powershell", "-Command", powershell_cmd], capture_output=True,creationflags=CREATE_NO_WINDOW) if res.returncode != 0: return f"Error on win lnk code: {res.returncode} error: {res.stderr}"