Test of existence of key's subkey.
vExistsKey = Key.ExistsKey (Name as String)
Where | Type | Optional | Default | Description |
---|---|---|---|---|
Name | String | Name of the sub key. |
Boolean
Test of key's existence. |
'Get RegEdit.Server object Set S = CreateObject("RegEdit.Server") If Not S.GetKey("HKLM").ExistsKey("Software\MyApp") Then Wscript.Echo "MyApp is not installed." End If |
Set TEMP and TMP Environment variables |
Option Explicit Dim S, Key, SubKey Dim TempFolder If Wscript.Arguments.Count = 0 Then Wscript.Echo "SetTemp - same temp folder for all users on this computer" & vbCrLf & _ " cscript settemp.vbs tempfolder" & vbCrLf Wscript.Quit End If 'Read the temp folder argument TempFolder = Wscript.Arguments(0) 'Get RegEdit.Server object Set S = CreateObject("RegEdit.Server") 'Get a key Set Key = S.GetKey("HKU") For Each SubKey In Key.SubKeys Wscript.Echo SubKey.Name If SubKey.ExistsKey("Environment") Then Wscript.Echo SubKey.SubKeys("Environment").Values("TEMP") Wscript.Echo SubKey.SubKeys("Environment").Values("TMP") 'Set TEMP and TMP registry Environment variables SubKey.SubKeys("Environment").Values("TEMP") = TempFolder SubKey.SubKeys("Environment").Values("TMP") = TempFolder End If Next 'Set system temp Wscript.Echo S.GetKey("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment").Values("TEMP") Wscript.Echo S.GetKey("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment").Values("TMP") S.GetKey("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment").Values("TEMP") = TempFolder S.GetKey("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment").Values("TMP") = TempFolder |
Close, CreateKey, Delete, ExistsKey, ExistsValue, Flush, numSubKeys, numValues, Save
Class, hKey, LastWriteTime, Name, SubKeys, Values
One registry key.
Intuitive, easy to use COM interface to windows registry. Set of classes to read/enumerate/modify windows registry keys and values from ASP, VBS and T-SQL.
© 1996 - 2009 Antonin Foller, Motobit Software | About, Contacts | e-mail: info@pstruh.cz