![]() |
Creating Shortcuts with python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Creating Shortcuts with python (/thread-37524.html) |
Creating Shortcuts with python - Oshadha - Jun-22-2022 Is there a way for me to create a shortcut (.lnk) file using python. I searched everywhere, but found no answer that works :( RE: Creating Shortcuts with python - snippsat - Jun-22-2022 Both pywin32 and winshell shortcut can do this. Can do quick test with to see in work with newest Python 3.10.5 as winshell is old. import os, sys import winshell link_filepath = os.path.join(winshell.desktop(), "python.lnk") with winshell.shortcut(link_filepath) as link: link.path = sys.executable link.description = "Shortcut to python"Work fine create a working shortcut to Python on the Desktop. RE: Creating Shortcuts with python - Oshadha - Jun-23-2022 (Jun-22-2022, 12:13 PM)snippsat Wrote: Both pywin32 and winshell shortcut can do this. Throws this error: When I try pip install win32con It gives another error: Im using the newest version of python: 3.10.5 64BitI found many websites using this winshell module and I gave up because it gave the same error.EDIT: I solved the error. pip install pywin32 solves the issue!Thanks for everyone's help! |