def create_shortcut(shortcut_path, target, description, *args): quoted_args = None if args: quoted_args = [] for arg in args: quoted_args.append('"{}"'.format(arg)) quoted_args = ' '.join(quoted_args) winutil.manage_shortcut(shortcut_path, target, description, quoted_args)
def shortcut_exists_at(shortcut_path, target): if not os.access(shortcut_path, os.R_OK): return False name = winutil.manage_shortcut(shortcut_path, None, None, None) if name is None: return False return os.path.normcase(os.path.abspath(name)) == os.path.normcase(os.path.abspath(target))