Problems for users launching compiled executable

I am trying to deploy an executable from MATLAB R2025b in a Windows 11 Enterprise environment. I am generating stand-alone executables which are deployed to a network location (call it the deploy directory) for use by engineering staff. I have read, write, and execute privileges in this directory. My users have only read and execute privileges in the deploy directory. I can launch the executable, but my users cannot with an error message of "Access is Denied".
I realize of course that without other direction MATLAB tries to extract files (CTF) to the working directory (the directory in which the executable resides). In previous instances, I have (with success) created a PowerShell script (launched by shortcut) which sets the appropriate environment variables, launches the executable, and waits for the executable to be closed, thus preserving the environment variables for the duration of the PowerShell session.
I have included the text of my PowerShell files below (The MathWorks does not allow *.ps1 files on this forum).
With a newer app, this approach fails. In the time between, we have changed from a legacy domain on Windows 10 to a parent-company domain on Windows 11.
My questions are these:
  1. What hangups in either MATLAB or Windows 11 environments could cause the situation described above?
  2. Short of changing IT security settings, what work-arounds can I try?
  3. What other things should I be investigating?
Note that if this is 2025b specific, I do have 2026a and 2024b installed.
## Launch_App.ps1 ##
# Create writable directories if needed
New-Item -ItemType Directory -Force -Path "$env:LOCALAPPDATA\MCRCache" | Out-Null
New-Item -ItemType Directory -Force -Path "$env:LOCALAPPDATA\Temp" | Out-Null
# Set environment variables for this PowerShell session
$env:MCR_CACHE_ROOT = "$env:LOCALAPPDATA\MCRCache"
$env:TEMP = "$env:LOCALAPPDATA\Temp"
$env:TMP = "$env:LOCALAPPDATA\Temp"
# Set the MATLAB local environment variables
. "$PSScriptRoot\MatlabRuntime.ps1"
Initialize-MatlabRuntime
# Launch MATLAB-compiled application
$appDir = "O:\Deploy\App\Rev_A"
$appExe = "App_Name.exe"
Start-Process `
-FilePath (Join-Path -Path $appDir -ChildPath $appExe) `
-WorkingDirectory $appDir `
-Wait
## MATLABRuntime.ps1 ##
function Initialize-MatlabRuntime {
[CmdletBinding()]
param()
$BaseDir = Join-Path $env:LOCALAPPDATA "MATLAB_Runtime"
$CacheDir = Join-Path $BaseDir "cache"
$PrefDir = Join-Path $BaseDir "prefs"
$TempDir = Join-Path $BaseDir "temp"
$JavaTmp = Join-Path $BaseDir "javatmp"
$CtfDir = Join-Path $CacheDir "ctf"
$Dirs = @(
$CacheDir,
$PrefDir,
$TempDir,
$JavaTmp,
$CtfDir
)
foreach ($Dir in $Dirs) {
if (-not (Test-Path -LiteralPath $Dir -PathType Container)) {
New-Item -ItemType Directory -Path $Dir | Out-Null
}
}
$env:MCR_CACHE_ROOT = $CacheDir
$env:MW_CTF_CACHE = $CtfDir
$env:MATLAB_PREFDIR = $PrefDir
$env:TEMP = $TempDir
$env:TMP = $TempDir
$env:_JAVA_OPTIONS = "-Djava.io.tmpdir=$JavaTmp"
}

Answers (0)

Categories

Products

Release

R2025b

Tags

Asked:

about 11 hours ago

Edited:

dpb
about 7 hours ago

Community Treasure Hunt

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

Start Hunting!