I want to change the value in the registry.
In a batch file I have:
ECHO Changes in reg
reg import "C:\modifySip.reg"
and in modifySip.reg
I have:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Lync]
"ServerSipUri"="[email protected]"
And it works!
However, now I want to use part of the existing registry value and modify it.
I need to keep the User.Test@
part of the URI, and replace the domainA.com
part, with domainB.com
.
Given the information you've provided, and as mentioned in my comment, there's no need to use a .reg
file for this task. I'd offer the following batch file solution:
@Echo Off
SetLocal EnableExtensions
Set "NewDomain=domainb.com"
Set "RegKey=HKCU\Software\Microsoft\Office\16.0\Lync"
Set "ValName=ServerSipUri"
For /F "EOL=H Tokens=2*" %%G In ('""%__AppDir__%reg.exe" Query "%RegKey%" /V "%ValName%" 2> NUL"'
) Do For /F "Tokens=1* Delims=@" %%I In ("%%H") Do "%__AppDir__%reg.exe" Add "%RegKey%" /V "%ValName%" /D "%%I@%NewDomain%" /F 1> NUL
Just modify line 4
to the actual domain string you require.