Extract MSI VBS Script

Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "MSI Files|*.Msi"
intResult = objDialog.ShowOpen
If intResult = 0 Then
Wscript.Quit
Else
End If
MsiSource = objDialog.FileName

Const My_Computer = &H11&
Const Window_Handle = 0
Const Options = 0
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(My_Computer)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(Window_Handle, "Extract Msi To :", Options, strPath)
If objFolder Is Nothing Then
Wscript.Quit
End If
Set objFolderItem = objFolder.Self
objPath = objFolderItem.Path
MsiDestination = objPath

Set objShell = CreateObject("Wscript.Shell")
objCommand = "MsiExec.exe /a " & Chr(34) & MsiSource & Chr(34) & " /qn TargetDir=" & Chr(34) & MsiDestination & Chr(34)
objShell.Run(objCommand)

MsgBox "Done"
objShell.Run "Explorer.exe /e," & MsiDestination


Download
/Files/CN/ExtractMSI.zip

你可能感兴趣的:(script)