If you want to use .Net "clr" (especially if you already require it):
First run this... you will have to ship the output of this command this with your application
"c:Program Files (x86)Microsoft SDKsWindowsv10.0AinNETFX 4.6.1 ToolsTlbImp.exe" %SystemRoot%system32wshom.ocx /out:Interop.IWshRuntimeLibrary.dll
tlbimp.exe might even be in the path if you installed the Windows SDK in a fairly standard way. But if not, it's OK, you'll just ship the "assembly" (fancy word for interface-providing dll in .Net land) with your application.
Then this code will work in python:
import clr
sys.path.append(DIRECTORY_WHERE_YOU_PUT_THE_DLL)
clr.AddReference('Interop.IWshRuntimeLibrary')
import Interop.IWshRuntimeLibrary
sc = Interop.IWshRuntimeLibrary.WshShell().CreateShortcut("c:\test\sc.lnk")
isc = Interop.IWshRuntimeLibrary.IWshShortcut(sc)
isc.set_TargetPath("C:")
isc.Save()
.... the above code, with far too much modification and preamble, might even work with Mono.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…