Having issues writing multiple line string value in a REG_SZ(Not reg_multi_sz) reg key
Thanks in advance for looking into the post.
I'm currently trying to package "Password agent 2016". The application asks for a license key with 3 lines. I need to create a reg key(license key) to create a package for deployment.
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Moon Software\Password Agent]
"Dir"="C:\\Program Files\\Moon Software\\Password Agent 2016\\"
I've tried the following but couldn't find a solution.
1. Adding the license key manually into the application and try to extract the reg key once registered: I've exported the key but having trouble installing it again since the registry editor doesn't take REG_SZ as multiline string.
2. Merging all the lines into a single line value: This is not accepted by the application as a license key.
3. Tried to convert it to a hexadecimal value and tried to install it. Example: "LicenseKey"=hex(1): 45,00,45,00,24,00,0d,0a,00.........". Got some progress with this but when I tried to install it using vbs/cmd or any script with Admin/System rights, it doesn't work. But when I install it with regedit /s "<regpath>.reg" command inside command prompt manually with admin/system rights, it works just fine.
4. Tried adding /n/r/t to each line. No luck on that as well.
Not to confuse you guys but I just need to install the license key with a multiple lined string value installed using a script.
Please help me out with this.
Answer Chosen by the Author
when I install it with regedit /s "<regpath>.reg" command inside command prompt manually with admin/system rights, it works just fine.So why not simply create a script that runs that command line and run it with admin rights?!?
If you want a more elegant approach (and possibly obfuscation of the key itself) and use a script, you could just add 'vbCRLF' to each line (for VBS) or ASCII 13 + ASCII 10 in some other languages.