function getmatlabdefaultserver()
getdefaultserver('MATLAB.Application');
function getdefaultserver(serverApplication)
if ~exist('serverApplication', 'var')
error('Please specify a server application');
end
try
serverAppCLSID = winqueryreg('HKEY_CLASSES_ROOT', [serverApplication '\CLSID\']);
progId = winqueryreg('HKEY_CLASSES_ROOT', ['CLSID\' serverAppCLSID '\']);
localServer32 = winqueryreg('HKEY_CLASSES_ROOT', ['CLSID\' serverAppCLSID '\LocalServer32\']);
disp(['The default Automation Server for "' serverApplication '" on this machine is:'])
disp(['ProgId: ' progId]);
disp(['LocalServer32: ' localServer32]);
disp(['CLSID: ' serverAppCLSID]);
serverAppPath = regexpi(localServer32, '.*\.exe', 'match', 'once');
serverAppPath = strrep(serverAppPath, '"', '');
if ~isempty(serverAppPath)
if exist(serverAppPath, 'file')
disp(['File exists: ''' serverAppPath '''']);
else
warning(['File does not exist: ' serverAppPath]);
end
end
catch
disp('There was an error while reading the registry.');
end
Best Answer