I am creating programmatically a shortcut using win32com.client
.
import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut("foo.lnk")
shortcut.Targetpath = "C:"
shortcut.WorkingDirectory = "C:"
shortcut.Arguments = " ".join(["my", "arguments"])
shortcut.WindowStyle = 3
shortcut.save()
The problem is now, that Windows marks this file as unsecure and pops up a window, whether the user really wants to run this potentially unsecure file.
Using Unblock-File foo.lnk
solves the problem.
However, how can I already programmatically fix this during shortcut creation using win32com.client
?