Reference/WriteRegExpandStr: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Created page with "WriteRegExpandStr root_key subkey key_name value Write a string to the registry. root_key must be one of: *''HKCR'' or ''HKEY_CLASSES_ROOT'' *''HKLM'' or ''HKEY_LOCAL_MACHINE''...")
 
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
WriteRegExpandStr
=WriteRegExpandStr=
 
root_key subkey key_name value


root_key subkey key_name value
Write a string to the registry. root_key must be one of:
Write a string to the registry. root_key must be one of:


Line 15: Line 16:
If root_key is ''SHCTX'' or ''SHELL_CONTEXT'', it will be replaced with HKLM if [[Reference/SetShellVarContext|SetShellVarContext]] is set to all and with HKCU if [[Reference/SetShellVarContext|SetShellVarContext]] is set to current.
If root_key is ''SHCTX'' or ''SHELL_CONTEXT'', it will be replaced with HKLM if [[Reference/SetShellVarContext|SetShellVarContext]] is set to all and with HKCU if [[Reference/SetShellVarContext|SetShellVarContext]] is set to current.


The error flag is set if the string could not be written to the registry. The type of the string will be REG_SZ for [[Reference/WriteRegStr|WriteRegStr]], or REG_EXPAND_STR for [[Reference/WriteRegExpandStr|WriteRegExpandStr]]. If the registry key doesn't exist it will be created.
The error flag is set if the string could not be written to the registry. The type of the string will be REG_SZ for [[Reference/WriteRegStr|WriteRegStr]], or REG_EXPAND_STR for WriteRegExpandStr. If the registry key doesn't exist it will be created.


<highlight-nsis>WriteRegExpandStr HKLM "Software\My Company\My Software" "Expand String Value" "%WINDIR%\notepad.exe"</highlight-nsis>
<highlight-nsis>WriteRegExpandStr HKLM "Software\My Company\My Software" "Expand String Value" "%WINDIR%\notepad.exe"</highlight-nsis>
''Command introduced with NSIS v1.60''

Latest revision as of 20:40, 4 June 2013

WriteRegExpandStr

root_key subkey key_name value

Write a string to the registry. root_key must be one of:

  • HKCR or HKEY_CLASSES_ROOT
  • HKLM or HKEY_LOCAL_MACHINE
  • HKCU or HKEY_CURRENT_USER
  • HKU or HKEY_USERS
  • HKCC or HKEY_CURRENT_CONFIG
  • HKDD or HKEY_DYN_DATA
  • HKPD or HKEY_PERFORMANCE_DATA
  • SHCTX or SHELL_CONTEXT

If root_key is SHCTX or SHELL_CONTEXT, it will be replaced with HKLM if SetShellVarContext is set to all and with HKCU if SetShellVarContext is set to current.

The error flag is set if the string could not be written to the registry. The type of the string will be REG_SZ for WriteRegStr, or REG_EXPAND_STR for WriteRegExpandStr. If the registry key doesn't exist it will be created.

WriteRegExpandStr HKLM "Software\My Company\My Software" "Expand String Value" "%WINDIR%\notepad.exe"

Command introduced with NSIS v1.60