I just tried to create a small Python script that first installs a certain package (PyMOL), based on the Python version installed on the system and then creates a shortcut to that program on the user's desktop.
The file I want to create a shortcut to, is then located in %APPDATA%/python/pythonVERSION/scripts/pymol.exe.
Step one works flawlessly and installs the package as expected. Step two, however turns out to be quite difficult in native Python.
All solutions I was able to find so far use packages like: win32com, pythoncom, swinlnk,
...
I don't want to have to install packages that I only need once for creating a shortcut on everyone's PC I am trying to install PyMOL.
So is there a way to create a shortcut to a file in native Python, without having to install any sort of 3rd party package?
Just to show some solutions, I already found:
Create shortcut files in Windows 7 using Python
https://www.blog.pythonlibrary.org/2010/01/23/using-python-to-create-shortcuts/
How to create a shortcut to a folder on Windows?
To follow up, as I had promised:
most code from: https://github.com/bristi/swinlnk/blob/e4bccd2be6e3e6fd501c627aead5602b132243fd/swinlnk/swinlnk.py
I just simplified it, to accomodate my needs. It would probably be easier, to just install the module, but now it does, what I need it to do. It creates a shortcut on the Desktop of the current user to the default installation path of PyMOL, in my case %APPDATA%/Python/PythonVER/Scripts/pymol.exe.
Code has mostly been simplified, in terms of checking if the shortcut is to a file, folder, or network share, so this only works, if you want to create a shortcut to a FILE on a LOCAL drive.