Function GetWinRarPath() As String On Error Resume Next GetWinRarPath = CreateObject("Wscript.Shell").RegRead( _ "HKEY_LOCAL_MACHINE\Software\Microsoft\" & _ "Windows\CurrentVersion\App Paths\winrar.EXE\Path") On Error GoTo 0 End Function Sub test() Dim sRarPath As String sRarPath = GetWinRarPath If Len(sRarPath) Then MsgBox sRarPath Shell sRarPath & "\winrar.exe", vbNormalFocus Else MsgBox "请确认是否已安装WINRAR.EXE!" End If End Sub
Function GetWinRarPath() As String On Error Resume Next GetWinRarPath = CreateObject("Wscript.Shell").RegRead( _ "HKEY_LOCAL_MACHINE\Software\Microsoft\" & _ "Windows\CurrentVersion\App Paths\winrar.EXE\Path") On Error GoTo 0 End Function Sub test() Dim sRarPath As String sRarPath = GetWinRarPath If Len(sRarPath) Then MsgBox sRarPath Shell sRarPath & "\winrar.exe", vbNormalFocus Else MsgBox "请确认是否已安装WINRAR.EXE!" End If End Sub
Function GetWinRarPath() As String On Error Resume Next GetWinRarPath = CreateObject("Wscript.Shell").RegRead( _ "HKEY_LOCAL_MACHINE\Software\Microsoft\" & _ "Windows\CurrentVersion\App Paths\winrar.EXE\Path") On Error GoTo 0 End Function Sub test() Dim sRarPath As String sRarPath = GetWinRarPath If Len(sRarPath) Then MsgBox sRarPath Shell sRarPath & "\winrar.exe", vbNormalFocus Else MsgBox "请确认是否已安装WINRAR.EXE!" End If End Sub