Exit code -1 on Registry operation

Hi guys,

i am trying to add HKCU registry entry (using the wizard or “reg add” and RunAsCurrentUser) and i keep getting “Command succeeded (Exit Code=-1)”.
needless to say, nothing is wtitten to the registry…
the full command is:
waithidden "__Download\RunAsCurrentUser.exe" reg add HKEY_CURRENT_USER\Software\Policies\Microsoft\office\16.0\outlook\options\mail /v junkmailimportlists /t REG_DWORD /d 1 /f

BTW - running the command manually from CMD works.
what is exit code -1? why is this not working?
thanks,

Hi,

May be this will help-

{user key of current user}\Software\Policies\Microsoft\office\16.0\outlook\options\mail /v junkmailimportlists /t REG_DWORD /d 1 /f

You can also take the reference of this Action Script.

action uses wow64 redirection false

delete __createfile
delete wizardedit.reg

createfile until @end_create_reg_file
Windows Registry Editor Version 5.00

[{user key of current user}\Software\Microsoft\Office\16.0\Excel\Options]
"Options"=dword:00000157
@end_create_reg_file

move __createfile wizardedit.reg
waithidden regedit /s "wizardedit.reg"

thanks for your answer.

when i run the suggested method, i get the following error:

Command failed (Substitution failed while writing file) createfile until @end_create_reg_file (action:339991)

thanks, Shlomi