简体   繁体   English

在 Windows 10 中使用带有 python 的 URL 创建快捷方式

[英]Create a shortcut using URL with python for windows 10

I have multiple links scraped , and I want a code that creates a shortcut for each link and saves on the desktop.我有多个链接被抓取,我想要一个代码,为每个链接创建一个快捷方式并保存在桌面上。 So whenever we click that link, It opens that particular URL on chrome.因此,每当我们单击该链接时,它都会在 chrome 上打开该特定 URL。 Can we do that using python ?我们可以使用 python 做到这一点吗?

Take a look at the answer to this question .看看这个问题的答案。 It solves both aspects of your problem:它解决了您问题的两个方面:

  • finding the correct desktop folder using the winshell package使用winshell 包找到正确的桌面文件夹

  • creating the link-file (*.url) by writing a text file with the following content通过编写具有以下内容的文本文件来创建链接文件 (*.url)

     [InternetShortcut] URL=https://stackoverflow.com/

Note that on my machine it asked whether to open the *.url file with my default internet browser or some other program when I double-clicked it.请注意,在我的机器上,当我双击它时,它询问是否使用我的默认 Internet 浏览器或其他程序打开 *.url 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM