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: |
|
||||||
Required: |
|
||||||
Optional: |
|
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: |
|
||||
Required: |
|
||||
Optional: |
|
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: |
|
||||
Required: |
|
||||
Optional: |
|
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: |
|
||||
Required: |
|
||||
Optional: |
|
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
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:
- 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 pathname:
- The registry key pathname appears before the equal sign "=" on each line.
- Each registry key pathname must be enclosed in single quotes.
- This includes the same analysis-related registry keys and values that are displayed by the -batchoptions help.
Registry value:
- The registry value appears after the equal 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 "/" may be used as a directory separator on Windows and Linux. The back slash "\" may be used as a directory separator on Windows only.
- The back slash "\" is used as an escape character in the value string. That it, 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.
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.
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