Split/insert comma to string?
Posted: 22 May 2011 11:43
Hi
I'm trying to export two REG_Binary value from the users profile to a .reg file (This script should run as an logoff script)
But right now I'm not able to get the format correct, because the string I get from my script does not contain the commas (,) for every two digit.
The string is: 540065007300740020007300690067000000
But it has to be: 54,00,65,00,73,00,74,00,20,00,73,00,69,00,67,00,00,00,
So how do I insert these commas to the string?
Here is my script (I only have made it for one value so fare):
Hope someone can help me, I'm really stuck right now
Thanks
I'm trying to export two REG_Binary value from the users profile to a .reg file (This script should run as an logoff script)
But right now I'm not able to get the format correct, because the string I get from my script does not contain the commas (,) for every two digit.
The string is: 540065007300740020007300690067000000
But it has to be: 54,00,65,00,73,00,74,00,20,00,73,00,69,00,67,00,00,00,
So how do I insert these commas to the string?
Here is my script (I only have made it for one value so fare):
Code: Select all
@echo off
setlocal
set rkey=HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Default Outlook Profile\9375CFF0413111d3B88A00104B2A6676\00000001
set rvalue="Reply-Forward Signature"
set regexe=%SystemRoot%\System32\Reg.exe
for /f "Tokens=4" %%a in ('%regexe% QUERY "%rkey%" /v %rvalue%') do (
set rdata=%%a
)
set regfile=%userprofile%\mytst.reg
echo Windows Registry Editor Version 5.00>%regfile%
echo.>>%regfile%
echo [%rkey%]>>%regfile%
echo %rvalue%^=hex:%rdata%>>%regfile%
echo.>>%regfile%
endlocal
Hope someone can help me, I'm really stuck right now
Thanks