Setting or Removing Option Values in Configuration Files: UpdateRegistry Command
A command line tool, UpdateRegistry, is available to modify option settings in the options config files. You can use this command to add, change, or remove settings from any of the option config files. This tool is included in the installation directory of each product.
This feature is intended to make it easier for different users to use Ansys Electromagnetics tools installed on shared directories or network drives.
UpdateRegistry has multiple command line formats as shown below. The -Set format is used to set or change an option value. The -Delete format is used to delete an option setting. The following command line options are mutually exclusive: -Set, -Get, -Delete, -GetKeys, and -FromFile.
UpdateRegistry -Get Command
This is used to view an option value in an option config file. If the setting exists in the specified config file or files, then the value, the value type and the config file where the value was found will be reported. If no value is found, then that will also be reported.
Usage:
UpdateRegistry -Get -ProductName <name> -RegistryKey <keyPath> [ -RegistryLevel <level> ]
<name>
Required. The application or product name and version, as described above. For example, ElectronicsDesktop2018.1. If the name contains spaces, it must be enclosed within quotation marks.
<keyPath>
Required. The pathname of the option setting. For example:
Desktop/Settings/ProjectOptions/AnimationMemory.
<level>
Optional. A string denoting which config file to search. One of: install, install_machine, user, and user_machine. If the level is not specified, then all config files are searched in order of precedence.
UpdateRegistry -GetKeys Command
Use this command to view the allowed key names for all of the option settings, or to view a subset of the key names that match a string. For each key displayed, the current value, if any, is also reported. If a key has a value in multiple config files, then only the highest precedence value is reported.
Usage:
UpdateRegistry -GetKeys [ <pattern>] -ProductName <name> [ -Case ]
<pattern>
Optional. If no pattern is specified, then all allowed key names are reported. If a pattern is specified, then only keys that match the pattern are shown. For example: Settings/Project. If the name contains spaces, then it must be quoted. By default, the pattern match is case insensitive. If the -Case command line option is specified, then the pattern match is case sensitive.
<name>
Required. The application or product name and version, as described above. For example, ElectronicsDesktop2018.1. If the name contains spaces, it must be enclosed within quotation marks.
UpdateRegistry -Set Command
This command is used to add or modify an option setting in an option config file. If the option config file does not exist, it will be created. If the setting does not exist in the specified config file, it will be added. If the setting already exists in the specified config file, then the value will be changed to the specified value.
Usage:
UpdateRegistry -Set -ProductName <name>
-RegistryKey <keyPath>
-RegistryValue <value> [ -RegistryLevel <level>
<name>
Required. The application or product name and version, as described above. For example, ElectronicsDesktop2018.1. If the name contains spaces, it must be enclosed within quotation marks.
<keyPath>
Required. The pathname of the option setting. Example:
Desktop/Settings/ProjectOptions/AnimationMemory.
<value>
Required. The new value of the option, typically a string or a number. If the value contains spaces, it must be quoted.
<level>
Optional. A string denoting which config file to modify. One of: install, install_machine, user , and user_machine. If the level is not specified, then the user_machine (host-dependent user options) file is modified.
UpdateRegistry -Delete Command
This command is used to remove an option setting from an option config file. If the setting does not exist in the specified config file, the file will not be changed. If the setting exists in the specified config file, then it will be removed. A setting may need to be removed from an option config file to allow the setting from a lower priority file to be used by the application.
Usage:
UpdateRegistry -Delete -ProductName
<name>
-RegistryKey <keyPath>
[ -RegistryLevel <level> ]
<name>
Required. The application or product name and version, as described above. For example, ElectronicsDesktop2018.1. If the name contains spaces, it must be enclosed within quotation marks.
<keyPath>
Required. The pathname of the option setting. Example:
Desktop/Settings/ProjectOptions/AnimationMemory.
<level>
Optional. A string denoting which option config file to modify. One of: install, install_machine, user , and user_machine. If the level is not specified, then the user_machine (host-dependent user options) file is modified.
UpdateRegistry -FromFile Command
You can use this form of the UpdateRegistry command to set multiple key-value pairs from a file with a single UpdateRegistry command. You specify the -FromFile command line option. This option must be followed by a file name. The file may contain multiple entries, where each entry contains a registry key and a registry value. The key-value pairs are added to the registry level specified by the -RegistryLevel command line option; if no -RegistryLevel is specified, then the default registry level (user_machine) is used.
UpdateRegistry File Format
The file format is similar to the -batchoptions file format. An example UpdateRegistry file is shown below:
$begin 'AddEntries'
'TempDirectory'='C:/temp/AnsysEM'
'Desktop/Settings/ProjectOptions/HPCLicenseType'='Pool'
'Hfss/UseLegacyMultiprocessingLicense'=1
$end 'AddEntries'
Additional notes on the file format:
- The file may contain an arbitrary number of entries, one per line.
- Leading whitespace on each line is ignored. Spaces or tabs may be used to make the file more readable.
Registry key path name:
- The registry key pathname appears before the = sign on each line.
- Each registry key pathname must be enclosed in single quotes.
Registry value:
- The registry value appears after the = sign on each line.
- Integral registry values must not be enclosed in quotes.
- All other registry values are treated as strings, and must be enclosed in single quotes.
- The forward slash "/" and back slash "\" are directory separators on Windows.
- The back slash "\" is used as an escape character in the value string. That is, this character removes the special meaning of the following character.
- The single quote character normally ends the value string. The back slash may be used to remove this special meaning, and include a single quote in the string.
- To use a back slash as a directory separator on Windows, it must be escaped. That is, a double back slash "\\" is used to denote a single directory separator.
Alternative UpdateRegistry File Format
- Analysis Configuration File format, which is exported from the HPC and Analysis Options dialog box.
Setting Options via Configuration Files
Example Uses for Export Options Features