最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Unblock file programmatically that is created via win32com.client in Python on Windows - Stack Overflow

programmeradmin4浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论