aero-owner
asked on
check if key exists with batch file or vbs
Basically I need to see if the following key exists:
HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\Windows\ CurrentVer sion\Unins tall\{AC76 BA86-7AD7- 1033-7B44- A000000000 01}
If it does...run:
MsiExec /qb /X{AC76BA86-7AD7-1033-7B44 -A00000000 001}
if not...just keep on going in the batch or vbs..
don't care if it's a batch file or VBS...
Thanx in advance.
High points cause I need this fast.
Brian
HKEY_LOCAL_MACHINE\SOFTWAR
If it does...run:
MsiExec /qb /X{AC76BA86-7AD7-1033-7B44
if not...just keep on going in the batch or vbs..
don't care if it's a batch file or VBS...
Thanx in advance.
High points cause I need this fast.
Brian
ASKER
Awesome! works great!
one last thing (and I'll make a new question if you want)
after that...how would I, then, run in vbs:
oShell.Run "MsiExec /qb /I ""AcroStan.msi"" TRANSFORMS=""AcroStan.mst" " REBOOT=ReallySupress"
oShell.Run "msiexec /qb /i ""Adobe Acrobat 7.0.1 and Reader 7.0.1 Update.msi"""
oShell.Run "msiexec /qb /i ""Adobe Acrobat 7.0.2 and Reader 7.0.2 Update.msi"""
without them all running at once? can't find any sort of wait function.
one last thing (and I'll make a new question if you want)
after that...how would I, then, run in vbs:
oShell.Run "MsiExec /qb /I ""AcroStan.msi"" TRANSFORMS=""AcroStan.mst"
oShell.Run "msiexec /qb /i ""Adobe Acrobat 7.0.1 and Reader 7.0.1 Update.msi"""
oShell.Run "msiexec /qb /i ""Adobe Acrobat 7.0.2 and Reader 7.0.2 Update.msi"""
without them all running at once? can't find any sort of wait function.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You may use this .VBS
==========================
Dim oShell
Set oShell = CreateObject("WScript.Shel
sKeyPath= "HKLM\SOFTWARE\Microsoft\W
If RegKeyExists(sKeyPath) then
oShell.Run "MsiExec /qb /X{AC76BA86-7AD7-1033-7B44
Else
'Key doesn't exist
end if
Function RegKeyExists(ByVal sRegKey)
' Returns True or False based on the existence of a registry key.
' This part is a compliment from Torgeir Bakken.
Dim sDescription
RegKeyExists = True
sRegKey = Trim (sRegKey)
If Not Right(sRegKey, 1) = "\" Then
sRegKey = sRegKey & "\"
End If
On Error Resume Next
oShell.RegRead "HKEYNotAKey\"
sDescription = Replace(Err.Description, "HKEYNotAKey\", "")
Err.Clear
oShell.RegRead sRegKey
RegKeyExists = sDescription <> Replace(Err.Description, sRegKey, "")
On Error Goto 0
End Function
==========================