Hi,
I am trying to read a reg key from the registry. the problem is that if the
key doesn't exist, the script jumps to "If Err.Number <> 0 Then", or cause
runtime error, if i don't use "On Error Resume Next"
I wanted to use it in the following way:
Set RegistryOBJ = WScript.CreateObject("WScript.Shell")
'returns the path of my app writen in the registry
Get_ETS_PathInRegistry = RegistryOBJ.RegRead(ETS_RegistryLocation)
If ETS_UnInstallPath = False Then
'if the key doesn't exist, we can install the app
Install_ETS(ETS_InstallPath)
Else
'if the key exists, we should uninstall it and then install the new
version(might be in new path)
UnInstall_ETS(ETS_UnInstallPath)
'ETS_InstallPath is being obtained from user.
Install_ETS(ETS_InstallPath)
End If
The problem is that it doesn;t go to the "If ETS_UnInstallPath = False Then"
but as i described above, go to the end of the script and then ends the
script.
in this way, i will need to add in "If Err.Number <> 0 Then"
"Install_ETS(ETS_InstallPath)
" command.
Isn't there an elegant way to do so, or i should consider doing it using VC?