使用cx-freeze创建一个向桌面添加快捷方式的MSI [英] Use cx-freeze to create an msi that adds a shortcut to the desktop

查看:138
本文介绍了使用cx-freeze创建一个向桌面添加快捷方式的MSI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用cx-freeze为Python应用程序创建MSI安装程序。如何从桌面安装到应用程序的链接?

I am using cx-freeze to create an MSI installer for a Python application. How can I install a link to the application from the desktop?

推荐答案

要创建应用程序的快捷方式,请提供 shortCutName 和 shortcutDir 选项。 shortcutDir 可以命名任何系统文件夹属性(感谢Aaron)。例如:

To create a shortcut to the application, give the shortCutName and shortcutDir options to the Executable. The shortcutDir can name any of the System Folder Properties (thanks Aaron). For example:

from cx_Freeze import *

setup(
    executables = [
        Executable(
            "MyApp.py",
            shortcutName="DTI Playlist",
            shortcutDir="DesktopFolder",
            )
        ]
    )

您还可以将项目添加到 MSI快捷方式表中。这样,您可以创建多个快捷方式并设置工作目录(快捷方式的开始于设置)。

You can also add items to the MSI Shortcut table. This lets you create multiple shortcuts and set the working directory (the "start in" setting of the shortcut).

from cx_Freeze import *

# http://msdn.microsoft.com/en-us/library/windows/desktop/aa371847(v=vs.85).aspx
shortcut_table = [
    ("DesktopShortcut",        # Shortcut
     "DesktopFolder",          # Directory_
     "DTI Playlist",           # Name
     "TARGETDIR",              # Component_
     "[TARGETDIR]playlist.exe",# Target
     None,                     # Arguments
     None,                     # Description
     None,                     # Hotkey
     None,                     # Icon
     None,                     # IconIndex
     None,                     # ShowCmd
     'TARGETDIR'               # WkDir
     )
    ]

# Now create the table dictionary
msi_data = {"Shortcut": shortcut_table}

# Change some default MSI options and specify the use of the above defined tables
bdist_msi_options = {'data': msi_data}

setup(
    options = {
        "bdist_msi": bdist_msi_options,
    },
    executables = [
        Executable(
            "MyApp.py",
            )
        ]
    )

这篇关于使用cx-freeze创建一个向桌面添加快捷方式的MSI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆