Finding MCR version for a given exe

11 Ansichten (letzte 30 Tage)
Ariel Vaknin
Ariel Vaknin am 7 Mai 2020
Kommentiert: Image Analyst am 8 Mai 2020
I need to inspect many exe files and understand in which version thay where build in.
is there an inspection tool to do it?

Antworten (1)

Image Analyst
Image Analyst am 7 Mai 2020
Not that I know of, other than to run the app and look in the console window and try to see what it says it wants. But the problem is if the user double clicks the icon, the console window (if you even chose to have it appear) vanishes immediately if the required MCR library is not found. For that reason, I run this function in my compilation script, and I ship the txt file it creates with my app.
% Create a file that says what MATLAB release we need to run the compiled application(s).
% Deletes any older files.
% Sample Usage:
% MakeRequiredMATLABReleaseFile;
function MakeRequiredMATLABReleaseFile
try
s = ver('MATLAB');
releaseYear = s.Release(2:end-1);
fprintf('You are using MATLAB Release %s.\n', releaseYear);
% See if there are any old files there
filePattern = 'MATLAB Release *.txt';
d = dir(filePattern);
% Delete them if there are.
if ~isempty(d)
for k = 1 : length(d)
fullFileName = fullfile(d(k).folder, d(k).name);
delete(fullFileName);
end
end
fileName = sprintf('MATLAB Release %s is required.txt', releaseYear);
fid = fopen(fileName, 'wt');
fprintf(fid, 'To run these MATLAB-based applications you must have installed MATLAB run-time library release %s.\n', releaseYear);
fprintf(fid, 'You can download that installer from the internet here:\n');
fprintf(fid, 'https://www.mathworks.com/products/compiler/matlab-runtime.html\n');
fprintf(fid, 'This program was compiled on %s using MATLAB Release %s.\n', datestr(now), releaseYear);
fclose(fid);
catch ME
% Some error happened if you get here.
errorMessage = GetErrorMessage(ME); % Get error message with call traceback and file's date.
uiwait(errordlg(errorMessage)); % Pop up error message to show user what it is.
% Prints to command window or console window (if program is an executable).
fprintf('%s\n', errorMessage);
end
It will create a file, called something like "MATLAB Release R2020a is required.txt" in your folder with contents like this:
To run these MATLAB-based applications you must have installed MATLAB run-time library release R2020a.
You can download that installer from the internet here:
https://www.mathworks.com/products/compiler/matlab-runtime.html
This program was compiled on 07-May-2020 10:17:55 using MATLAB Release R2020a.
Now when I look at a folder with my exe, I can instantly tell what it was compiled with just by looking at the name of that text file (I don't even have to open it if I don't want to).
  4 Kommentare
Ariel Vaknin
Ariel Vaknin am 8 Mai 2020
that is exatcly the goal of this question, to skip the manualy operation of every exe file
Image Analyst
Image Analyst am 8 Mai 2020
Another way is you could write a program to look at the file date of the executable and look up the MCR version from that, but it's not reliable since there is no guarantee that the person was using the latest version of MATLAB when they compiled the program and created the executable.
I looked at the binary bytes of an executable I created and I didn't see anything in there that looked like the version number or release year. So I think that's probably a dead end.
If you're lucky, the person included the readme.txt file that the compiler creates in the installation. If they did, simply open the readme.txt file and it will tell you. If that file was not shipped with your installer, then that method won't work. Do you see this file in any of your program folders?
So you may be out of luck if you don't want to recompile and use the nice method I use. I don't think there is such a tool.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by