Hi all,
is there a way to edit or write multi part strings into the windows registry?
regards
migro
How to write or edit multi-part string in the windows registry
Moderators: Dorian (MJT support), JRL
- Dorian (MJT support)
- Automation Wizard
- Posts: 1380
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: How to write or edit multi-part string in the windows registry
It isn't possible with RegistryWriteKey so I consulted Marcus and he came up with this for you :
Code: Select all
VBSTART
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005
Sub WriteMultiSz(rootKeyStr, strKeyPath, strValueName, listStr)
Select case rootKeyStr
Case "HKEY_CLASSES_ROOT"
rootKey = HKEY_CLASSES_ROOT
Case "HKEY_CURRENT_USER"
rootKey = HKEY_CURRENT_USER
Case "HKEY_LOCAL_MACHINE"
rootKey = HKEY_LOCAL_MACHINE
Case "HKEY_USERS"
rootKey = HKEY_USERS
Case "HKEY_CURRENT_CONFIG"
rootKey = HKEY_CURRENT_CONFIG
End Select
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
arrStringValues = Split(listStr, vbCRLF)
oReg.SetMultiStringValue rootKey,strKeyPath,strValueName,arrStringValues
End Sub
VBEND
//Create a CRLF delimited list of strings
Let>list=first%CRLF%second%CRLF%third
//Write it like this:
VBRun>WriteMultiSz,HKEY_CURRENT_USER,SOFTWARE\MJTNET\MSched15,TestValue2,list
Yes, we have a Custom Scripting Service. Message me or go here
Re: How to write or edit multi-part string in the windows registry
Hi Dorian,
thx for you reply and the assistance of Marcus. I was not notified about your reply, so sorry for the delay in my answer.
Seems that will be exactly what I need. I will give you feedback as soon I tested the approach.
regards migro
thx for you reply and the assistance of Marcus. I was not notified about your reply, so sorry for the delay in my answer.
Seems that will be exactly what I need. I will give you feedback as soon I tested the approach.
regards migro
regards
migro
migro
Re: How to write or edit multi-part string in the windows registry
Hi together,
it works well when writing to HKEY_CURRENT_USER. When writing to HKEY_LOCAL_MACHINE it does not work.
I was logged in with local adminrights and even the compiled version executed as administrator does not make any difference.
Any ideas?
Thanks in advance
it works well when writing to HKEY_CURRENT_USER. When writing to HKEY_LOCAL_MACHINE it does not work.
I was logged in with local adminrights and even the compiled version executed as administrator does not make any difference.
Any ideas?
Thanks in advance
regards
migro
migro