0

Various Windows applications such as Matlab, Altair, Nastran etc use license servers, which require a system environment variable - LM_LICENSE_FILE, to be updated which would take a value along the lines of: %MSC_LICENSE_FILE%;%MATLAB_LICENSE_FILE%;%ALTAIR_LM_LICENSE_FILE% (if these 3 apps were installed).

Setting the variable for the individual apps using SETX is easy:

SETX MATLAB_LICENSE_FILE PORT@SERVER /M

But how would I set the LM_LICENSE_FILE variable to reflect the apps installed on a pc that reference this variable using a .cmd file? Ideally it would query the pc to see what apps (apps that use LM_LICENSE_FILE environment variables) are installed, set the individual app system environment variable and then set the correct LM_LICENSE_VARIABLE value.

Regards and thanks in advance

1 Answer 1

0

You can use something like wmic product get name,version in your batch file to list installed programs, but this doesn't generate a comprehensive list. So in addition to wmic you can make your batch file query known program installation locations in the registry (for example HKCU\Software, HKLM\Software, HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall, HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall etc.) using the reg command.

Once you've built up a list of installed programs your batch file can then add the required environment variables with the proper values.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .