Compiled Application Start Menu Folder

2 views (last 30 days)
Brian
Brian on 27 Jul 2021
Answered: Harsh Mahalwar on 19 Feb 2024
If I am releasing many compiled applications, I'd like for them all to appear in a single folder on the Start Menu (similar to how "Activate MATLAB 2021a", "Deactivate MATLAB 2021a", and "MATLAB 2021a" are in a folder titled "MATLAB 2021a"). Is this possible?

Answers (1)

Harsh Mahalwar
Harsh Mahalwar on 19 Feb 2024
Hi Brian,
As I can understand, you are trying to find a way to automate the process of generating a Start menu folder for your MATLAB application on windows. Unfortunately, I was also unable to find any existing options in MATLAB Apps installer to achieve the same.
Here's a workaround, You can use .bat (batch files) to automate this process, here’s an example for the same:
Workflow:
  1. setup.bat calls MyAppInstaller.exe
  2. MyAppInstaller.exe installs the application, the setup.bat waits for it's completion.
  3. After the completion of MyAppInstaller.exe, the createStartMenuShortcut.bat is called from setup.bat.
  4. createStartMenuShortcut.exe creates the Start menu shortcuts.
Inside setup.bat
cd "[path of the folder of your application installer]"
start /wait MyAppInstaller.exe
start createStartMenuShortcut.bat
Inside createStartMenuShortcut.bat
@echo off
setlocal
:: Set the name of the shortcut
set SHORTCUT_NAME=[Add your application's name here].lnk
:: Set the target path of the shortcut (e.g., the path to the executable)
set TARGET_PATH=[Add path to your executable here]
:: Set the Start menu path for the current user
set START_MENU_PATH=%appdata%\Microsoft\Windows\Start Menu\Programs\[Add name of your application here]
:: Create the shortcut
echo Creating shortcut in the Start menu...
if not exist "%START_MENU_PATH%" mkdir "%START_MENU_PATH%"
echo Set oWS = WScript.CreateObject("WScript.Shell") > "%temp%\temp.vbs"
echo sLinkFile = "%START_MENU_PATH%\%SHORTCUT_NAME%" >> "%temp%\temp.vbs"
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> "%temp%\temp.vbs"
echo oLink.TargetPath = "%TARGET_PATH%" >> "%temp%\temp.vbs"
echo oLink.Save >> "%temp%\temp.vbs"
:: Run the VBScript to create the shortcut
cscript /nologo "%temp%\temp.vbs"
:: Clean up the temporary VBScript file
del "%temp%\temp.vbs"
echo Shortcut created successfully.
endlocal
You can run this batch file as your application’s setup.
Third party applications like inno setup and NSIS setup etc, can also help here.
I hope this helps, thanks!

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!