120 @param targetPath path the shortcut shall point to |
120 @param targetPath path the shortcut shall point to |
121 @type str |
121 @type str |
122 @param iconPath path of the icon file |
122 @param iconPath path of the icon file |
123 @type str |
123 @type str |
124 """ |
124 """ |
125 from pywintypes import com_error |
125 from pywintypes import com_error # __IGNORE_WARNING_I102__ |
126 from win32com.client import Dispatch |
126 from win32com.client import Dispatch # __IGNORE_WARNING_I102__ |
127 |
127 |
128 with contextlib.suppress(com_error): |
128 with contextlib.suppress(com_error): |
129 shell = Dispatch("WScript.Shell") |
129 shell = Dispatch("WScript.Shell") |
130 shortcut = shell.CreateShortCut(linkPath) |
130 shortcut = shell.CreateShortCut(linkPath) |
131 shortcut.Targetpath = targetPath |
131 shortcut.Targetpath = targetPath |