把MS的补丁都下载下来,想通过批处理自动安装
但有的补丁可以使用
/Q /Z
的参数来让它静默安装,并且不重新启动
但有的补丁没有 /Z 参数
如果加了 /Z 参数,就不安装...
/Q 是全部通用,但是只加 /Q 的话...重启的次数会很多...通过补丁的版本信息中的“Self-Extractor-Ver”发现,值为“SFXCAB”的可以使用 /Q /Z 参数(/norestart参数无效)
其他的可以使用 /Q /norestart 参数
但到底要如何获取到这个值呢??
批处理中估计没戏,VBS可以吗??

解决方案 »

  1.   

    Private Declare Function GetVersion Lib "kernel32" Alias "GetVersion" () As Long
    Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
      

  2.   

    这是VB里才有的吧?
    我在VBS里试了,提示没有这个函数...
      

  3.   

    http://sdxylijian.blog.163.com/blog/static/11027644020101022112636629/
      

  4.   

    '记得引用Microsoft Scripting RuntimeFunction GetVer(FilePathName As String) As Integer
        Dim fso As FileSystemObject
        Set fso = New FileSystemObject
        Dim fver As String, verStr() As String
        If Dir(FilePathName, vbNormal) = "" Then
           MsgBox FilePathName & "???"
           Exit Function
        End If
        GetVer = 0
        fver = fso.GetFileVersion(FilePathName)
        If fver <> "" Then
                 
                 verStr = Split(fver, ".")
                 GetVer = Val(verStr(UBound(verStr)))
        End If
    End Function