python - Create web shortcut in windows in python
问题描述
Create shortcut files in Windows 10 using Python 3.7.1
this is for shortcut to local files
How to create a shortcut to https://xxxxx.com
解决方案
You'll be needing winshell for this, which would make finding user-specific paths and folders easy. Here's the script:
import os, winshell
desktop = winshell.desktop()
path = os.path.join(desktop, "ShortcutName.url")
target = "https://xxxxx.com"
shortcut = file(path, 'w')
shortcut.write('[InternetShortcut]\n')
shortcut.write('URL=%s' % target)
shortcut.close()
推荐阅读
- excel - VBA API REST - 返回状态 500
- c++ - 将字符串作为输入并将其拆分为单词的函数。标点符号应该被忽略
- javascript - 您将如何创建一个自动昵称系统,每个新成员的昵称数量都会增加?
- angular - 需要帮助:Angular 路由器和导航项目不起作用
- java - 自 Wildfly 15 以来,Arquillian 托管测试不再有效
- javascript - 如何使用 react-big-calendar 获取时间段的时间?
- javascript - 使用来自 AJAX 调用的动态 HTML 重新渲染 Vue 组件
- vba - 如何让 Shapes.HasTitle 找到演示文稿中的所有标题(VBA、.ppt)?
- firebase - Firestore 增量浮点问题
- sql - SQL - 如果数据不可用,则获取默认 NULL 值