Compiled Application Start Menu Folder

조회 수: 1 (최근 30일)
Brian
Brian 2021년 7월 27일
답변: Harsh Mahalwar 2024년 2월 19일
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?

답변 (1개)

Harsh Mahalwar
Harsh Mahalwar 2024년 2월 19일
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!

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by