Link to home
Start Free TrialLog in
Avatar of Indarnav
Indarnav

asked on

set default

the attached code when run add new key with name newkey. can you edit code so that it also gives values to "(default)" key generated when newkey is generated. ref. pciture attached too. in picture, newkey is added and default string key has value =value not set.

i want to give value to it.
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject( _
    "winmgmts:{impersonationLevel=impersonate}!\\" & _
   strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\NewKey"
objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
WScript.Echo "Created registry key HKEY_LOCAL_MACHINE\SOFTWARE\NewKey"

Open in new window

Untitled.jpg
Avatar of yehudaha
yehudaha
Flag of Israel image

i dont think you can set a value to (default)

but you can create another key like this
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject( _
    "winmgmts:{impersonationLevel=impersonate}!\\" & _
   strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\NewKey"
objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
strkey = "(Default)"
value = "test"
objreg.setstringvalue HKEY_LOCAL_MACHINE,strKeyPath,strKey,value
WScript.Echo "Created registry key HKEY_LOCAL_MACHINE\SOFTWARE\NewKey"

Open in new window

Avatar of Indarnav
Indarnav

ASKER

but most of thrid party software assign values? how will they? like u can see in attached picture.
Untitled.jpg
ASKER CERTIFIED SOLUTION
Avatar of yehudaha
yehudaha
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
u did great ..i was looking for this for last one day..thanks a lot
no problem , thaks for the tip