Setting or Removing Option Values in Configuration Files: UpdateRegistry Command

UpdateRegistry is a command line tool used 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 makes it easier for different users to use Ansys Electromagnetics tools installed on shared directories or network drives.

The UpdateRegistry command has multiple command line formats, as shown below.

The following command line options are mutually exclusive:

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.

Example:
UpdateRegistry -Set -ProductName <name> -RegistryKey <keyPath> -RegistryValue <value> [ -RegistryLevel <level> ]
   
Required:
<name> The application or product name and version. For example, ElectronicsDesktop2024.2. If the name contains spaces, it must be quoted. The name can be found in the ProductList.txt file in the install directory: ...\AnsysEM\<Version>\Win64\config\
<keyPath> The pathname of the option setting. This includes the same analysis-related registry keys and values that are displayed by the -batchoptions help. For example, Desktop/Settings/ProjectOptions/AnimationMemory
<value> The new value of the option, typically a string or a number. If the value contains spaces, it must be quoted.
   
Optional:
<level> When specifying -RegistryLevel, this is a string denoting which config file to modify. One of: install, install_machine, user, and user_machine. If the level is not specified, the user_machine (host-dependent user options) file is modified.

UpdateRegistry -Get Command

This command 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.

Example:
UpdateRegistry -Get -ProductName <name> -RegistryKey <keyPath> [ -RegistryLevel <level> ]
   
Required:
<name> The application or product name and version. For example, ElectronicsDesktop2024.2. If the name contains spaces, it must be quoted. The name can be found in the ProductList.txt file in the install directory: ...\AnsysEM\<Version>\Win64\config\
<keyPath> The pathname of the option setting. This includes the same analysis-related registry keys and values that are displayed by the -batchoptions help. For example, Desktop/Settings/ProjectOptions/AnimationMemory
   
Optional:
<level> When specifying -RegistryLevel, this is a string denoting which config file to modify. 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

This command is used 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.

Example:
UpdateRegistry -GetKeys [ <pattern> ] -ProductName <name> [ -Case ]
   
Required:
<name> The application or product name and version. For example, ElectronicsDesktop2024.2. If the name contains spaces, it must be quoted. The name can be found in the ProductList.txt file in the install directory: ...\AnsysEM\<Version>\Win64\config\
   
Optional:
<pattern> 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, it must be quoted. By default, the pattern match is case insensitive.
-Case If this command line option is specified, then the pattern match is case sensitive.

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.

Example:
UpdateRegistry -Delete -ProductName <name> -RegistryKey <keyPath> [ -RegistryLevel <level> ]
   
Required:
<name> The application or product name and version. For example, ElectronicsDesktop2024.2. If the name contains spaces, it must be quoted. The name can be found in the ProductList.txt file in the install directory: ...\AnsysEM\<Version>\Win64\config\
<keyPath> The pathname of the option setting. This includes the same analysis-related registry keys and values that are displayed by the -batchoptions help. For example, Desktop/Settings/ProjectOptions/AnimationMemory
   
Optional:
<level> When specifying -RegistryLevel, this is a string denoting which config file to modify. One of: install, install_machine, user, and user_machine. If the level is not specified, 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 filename. 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

Note:

Functionality featured in the example(s) in this section applies to multiple design types.

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'

$end 'AddEntries'

Additional notes on the file format:

Registry key pathname:

Registry value:

Alternative UpdateRegistry File Format:

Note:

If a current registry does not exist, Ansys Electronics Desktop can detect earlier minor versions of same application on the same machine. If such a registry exists (and does not involve -help, -batchoptionhelp, IsBatchMode(), -regserver, -unregserver, running a script, or non graphical mode), a prompt displays allowing you to port the registry from an earlier version.

Workaround for HFSS Design Setting for Power S

Use Power S Parameter Definition in HFSS Design Settings can be set using UpdateRegistry but requires the following workaround.

HFSS Design Settings window, S Parameter definition highlighted.

Add one line in ElectronicsDesktopRegistrySyntax.xml.

-------------------------------------------------------------------

<KEY ObjectName="Hfss" RegObjectType="0">

...

<KEY ObjectName="Preferences" RegObjectType="0">

...

<VALUE ObjectName="UseFerriteMaterials" Value="1" ValueType="4"/>

<VALUE ObjectName="UsePowerS" Value="0" ValueType="4"/> add this line

<VALUE ObjectName="UseWizard" Value="1" ValueType="4"/>

...

-------------------------------------------------------------------

Then execute

"C:\Program Files\AnsysEM\v242\Win64\UpdateRegistry.exe" -Set -ProductName ElectronicsDesktop2024.2 -RegistryKey "Hfss\Preferences\UsePowerS" -RegistryValue 1