Nailz
05-16-2002, 03:45 AM
How do I get the contents of a Registry key if it hasn't been populated yet?
Sounds odd, but the reason is that I have a script that will check for a reg key and, if empty, run some configuration settings then set the key. This way the next time the script runs it will see the key and quit.
But if a do something like:
myRegKey = wsh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\PRE SET")
Where PRESET will be set to "1" for example if the script has already been run. The check would be:
If myRegKey = "" Then
... Run Configuration
... wsh.RegWrite"...\PRESET","1","REG_SZ"
End If
wscript.quit 1
The problem is that the script errors out because PRESET doesn't exist yet.
How do I get around this??
Sounds odd, but the reason is that I have a script that will check for a reg key and, if empty, run some configuration settings then set the key. This way the next time the script runs it will see the key and quit.
But if a do something like:
myRegKey = wsh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\PRE SET")
Where PRESET will be set to "1" for example if the script has already been run. The check would be:
If myRegKey = "" Then
... Run Configuration
... wsh.RegWrite"...\PRESET","1","REG_SZ"
End If
wscript.quit 1
The problem is that the script errors out because PRESET doesn't exist yet.
How do I get around this??