Introduction
This article will discuss how to create a shortcut based on user input using a property value and Create a shortcut using installscript and delete the shortcut on uninstall
Instructions
This article explains how to create a shortcut based on user request. This information applies to the following InstallShield project types:
- Basic MSI
- Installscript MSI
Steps to create a Project:
- Create Basic MSI Project
- Add a Feature and add component and files inside component
- Add exe files to component for which we want to create a shortcut.
- Go to installscript view and Right and add Setup.rul
- Copy paste the code at the bottom of this article into setup.rul (Replace shortcut name as per your exe added in components Example: Notepad.exe)
- Make sure CreateShortCut and DeleteShortCut functions are added
- Go to CustomAction view and add 2 Installscript Custom Actions and rename it.(CreateShortcut,DeleteShortcut)
- For Create Shortcut CA select the function CreateShortcut and for Delete Shortcut CA select the function name as DeleteShortcut from drop down
- Set the Condition for both Customaction (for EX: Create shortcut add condition NOT installed, and for Delete Shortcut add REMOVE~="ALL")
- And select Install Exec sequence as required.
- Go to Dialogs and Add a new Interior Dialog dialog
- Go to property manager and add 2 property DESKTOP_SHORTCUT and START_MENU_SHORTCUT
- Make sure the value column is empty, so that the checkbox is unchecked by default
- Rename the new dialog (Example: ShortcutDialog)
- And add 2 checkbox like shown below
- And set above created 2 property to this 2 checkbox filed
- Now Sequence the new dialog (ShortcutDialog) BACK and NEXT button as needed under behavior.
- EX: BACK --> Customer information , NEXT button to Setup Type
- Similarly in Customer information Dialog the NEXT Button should be change to ShortcutDialog
- Save and build the project
- Install the setup.exe and click NEXT and go to Shortcut checkbox dialog
- Click NEXT and Complete Installation
- Check shortcut created under desktop and under Appdata folder (EX: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\CompanyName)
#include "ifx.h"
export prototype CreateShortCut(HWND);
export prototype DeleteShortCut(HWND);
function CreateShortCut(hMSI)
STRING szShortcutFolder, szName, szCommandLine, szWorkingDir ;
STRING szIconPath, szShortCutKey,szValue,szValue1;
STRING szProgram, szParam, szFolderDir,szCmd;
NUMBER nIcon, nFlag, nResult, nvBufferSize;
begin
//Get Supportdir for icon
szIconPath = WINDIR ^ "regedit.exe";
//szIconPath = sMySUPPORTDIR +"\\" + "icon32.ico";
szShortcutFolder = FOLDER_DESKTOP;
szName = "DesktopShortcut";
szCommandLine = INSTALLDIR ^ "Notepad2.exe";
LongPathToQuote (szCommandLine, TRUE);
szWorkingDir = "";
nIcon = 1;
szShortCutKey = "";
nFlag = CS_OPTION_FLAG_REPLACE_EXISTING|CS_OPTION_FLAG_RUN_MINIMIZED;
MsiGetProperty(hMSI,"DESKTOP_SHORTCUT",szValue,nIcon);
if ( szValue == "1") then
Delay (2);
// Create the folder shortcut, and show the folder it points to.
if ( CreateShortcut(szShortcutFolder, szName, szCommandLine,szWorkingDir, szIconPath, nIcon, szShortCutKey,nFlag) < 0) then
Delay (1);
MessageBox ("DESKTOP Shortcut Not Created.", SEVERE);
endif;
endif;
//Creating StartMenu Shortcut
szIconPath = INSTALLDIR ^ "Explorer.exe";
szShortcutFolder = FOLDER_STARTMENU ^ "Programs\\CompanyName";
szName = "StartmenuShortcut";
szCommandLine = INSTALLDIR ^ "Uno.exe";
LongPathToQuote (szCommandLine, TRUE);
szWorkingDir = "";
nIcon = 1;
szShortCutKey = "";
nFlag = CS_OPTION_FLAG_REPLACE_EXISTING|CS_OPTION_FLAG_RUN_MINIMIZED;
MsiGetProperty(hMSI,"START_MENU_SHORTCUT",szValue1,nIcon);
if ( szValue1 == "1") then
Delay (2);
// Create the folder shortcut, and show the folder it points to.
if ( CreateShortcut(szShortcutFolder, szName, szCommandLine,szWorkingDir, szIconPath, nIcon, szShortCutKey,nFlag) < 0) then
Delay (1);
MessageBox ("STARTMENU Shortcut Not Created.", SEVERE);
endif;
endif;
end;
//Script to delete shortcut on uninstallation.
function DeleteShortCut(hMSI)
#define shortcutName "DesktopShortcut"
#define shortcutName1 "StartmenuShortcut"
STRING szCompany,szStartMenuPath,startMenuShortcut,szDesktop,szDesktopShortcut;
STRING nvSMProp,nvDesktopProp;
NUMBER nBuffer;
begin
nBuffer = MAX_PATH + 1;
szDesktop = FOLDER_DESKTOP;
szDesktopShortcut = INSTALLDIR ^ "Notepad2.exe";
if (Is(FILE_EXISTS, szDesktopShortcut) = FALSE) then
Delay (1);
DeleteShortcut(szDesktop, shortcutName);
else
MessageBox("No shortcut to delete", INFORMATION);
endif;
szCompany = FOLDER_COMMON_APPDATA + "Microsoft\\Windows\\Start Menu\\Programs\\CompanyName\\";
if (Is(FILE_EXISTS, szDesktopShortcut) = FALSE) then
Delay (1);
DeleteShortcut(szCompany, shortcutName1);
else
MessageBox("No shortcut to delete", INFORMATION);
endif;
end;
More Information
Clickherefor installscript help documentation on create shortcut
Clickherefor installscript help documentation on delete shortcut
Was this helpful?
Related Articles
Set All Component 64bit Option to “YES “ Using Installshield Automation Interface Script 11Number of Views How to Create an Internet Shortcut with .url file and msedge.exe 22Number of Views How to Use Python with the InstallShield Automation Interface 9Number of Views Using the Automation Interface With VB .NET 3Number of Views Create a Major Upgrade 5Number of Views
Revenera Assistant
Online
Hi, I am Reva - Ask me anything.
Updates
No new updates
Chat
Home
Updates
/**/
Thanks for the feedback!
Your feedback has been saved.Rate this response:
1
2
3
4
5
Add Additional feedback ( Optional )
0/240
English
English
Language changed successfully
Something went wrong
Email sent successfully
Something went wrong
Case create successfully
Are you sure you want to cancel
the case creation?
Please select a product to submit the case.
Please select a product version to submit the case.
0/255
Upload Attachment
File Upload
Maximum file
size allowed is 3 MB.
File type
not supported.
Supported file types:
Documents (.txt, .doc, .docx, .pdf), Images (.jpg, .png), Comma Separated Files
(.csv) Speadsheets (.xlsx, .xls)
Are you sure you want to cancel the case creation?
Case closed successfully
File Upload
Maximum file size allowed is 3 MB.
File type not supported.
Supported file types:
Documents (.txt, .doc, .docx, .pdf), Images (.jpg, .png), Comma Separated Files
(.csv) Speadsheets (.xlsx, .xls)
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
File Upload
Maximum file
size allowed is 3 MB.
File type
not supported.
Supported file types:
Documents (.txt, .doc, .docx, .pdf), Images (.jpg, .png), Comma Separated Files
(.csv) Speadsheets (.xlsx, .xls)
© 2026 Flexera Software. All Rights Reserved.
Case id: 00001065
Activity: Status change: 2 hours ago