How can I add entries to the Start Menu on Windows?

asked 13 Sep '11, 09:29

Jake's gravatar image

Jake ♦♦
826222226235
accept rate: 98%


You can easily configure entries in the Start Menu for your application using the Builder graphical interface. You just need to load your project XML file and go to "Files" -> "Start Menu (Windows)". There you may add new shortcuts and folders using the icons on the right panel.

In case you want to add Start Menu shortcuts by editing directly the XML file, you just need to add a <startMenuShortcutList> inside a <component> element, for instance:

<startMenuShortcutList>
  <startMenuShortcut>
    <comment>Start${product_fullname} service</comment>
    <name>Start ${product_fullname} service</name>
    <windowsExec>${installdir}\ctl.bat</windowsExec>
    <windowsExecArgs>start</windowsExecArgs>
    <windowsIcon>${installdir}\youricon.ico</windowsIcon>
    <windowsPath>${installdir}</windowsPath>
  </startMenuShortcut>
  <startMenuShortcut>
    <comment>Stop ${product_fullname} service</comment>
    <name>Stop ${product_fullname} service</name>
    <windowsExec>${installdir}\ctl.bat</windowsExec>
    <windowsExecArgs>stop</windowsExecArgs>
    <windowsIcon>${installdir}\youricon.ico</windowsIcon>
    <windowsPath>${installdir}</windowsPath>
  </startMenuShortcut>
</startMenuShortcutList>

The code above will create a new entry in the Start Menu (which name will defaults to the <fullName> project property, although you can customize it through the <startMenuGroupName> property), and inside it it will create two shortcuts.

You can also create folders using the <startMenuFolder> tag, which can contain additional <startMenuShortcutList> elements, to achieve more complex designs:

  <startMenuShortcutList>
    <!-- Here you may place any shortcuts that will be placed directly 
    under the main application folder in the Start Menu -->
    <startMenuFolder>
      <name>Some Name</name>
      <platforms>windows</platforms>
      <startMenuShortcutList>
        <!-- Here you may place any shortcuts to be placed inside the folder -->
      </startMenuShortcutList>
    </startMenuFolder>
  </startMenuShortcutList>

The shortcuts will be by default installed for All Users, in case the user running the installer is an Administrator, or for the current user otherwise. To force the shortcuts to be installed for the current user only, no matter if it is an administrator or not, you may set the following property:

<installationScope>user</installationScope>

You can also create optional shortcuts depending on the user input:

<parameterList>
    ...
    <booleanParameter>
        <displayStyle>checkbox-left</displayStyle>
        <name>createshortcut</name>
        <description>Would you like to create a start menu shortcut?</description>
        <value>1</value>
    </booleanParameter>
    ...
</parameterList>
<startMenuShortcutList>
    <startMenuShortcut>
        <comment>Optional uninstallation shortcut of ${product_fullname}</comment>
        <name>Uninstall ${product_fullname}</name>
        <runInTerminal>0</runInTerminal>
        <windowsExec>${installdir}/${uninstallerName}.exe</windowsExec>
        <windowsExecArgs></windowsExecArgs>
        <windowsIcon></windowsIcon>
        <windowsPath>${installdir}/</windowsPath>
        <ruleList>
            <isTrue value="${createShortcut}" />
        </ruleList>
    </startMenuShortcut>
</startMenuShortcutList>
link

answered 13 Sep '11, 09:34

Jake's gravatar image

Jake ♦♦
826222226235
accept rate: 98%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×13
×8
×1

Asked: 13 Sep '11, 09:29

Seen: 5,611 times

Last updated: 15 Sep '11, 07:09