. . . Function CleanUpTemp
Dim f,sf,f1
'remove temporary setup directories IXPxxx.TMP with Common.Stater.BootStrapper.exe and VSD*.tmp with PreCheck
Set f = fso.GetFolder(WshShell.ExpandEnvironmentStrings("%TEMP%"))
Set sf = f.SubFolders
For Each f1 in sf
'do not remove files of current setup / date
If Not (StrComp(Left(f1.DateLastAccessed,10),Left(Now,10)) = 0 ) Then
If (StrComp(Right(f1.name,4),".TMP") = 0 ) Then
If (StrComp(Left(f1.name,3),"IXP") = 0 ) Then
If fso.FileExists(f1.Path + "\Common.Starter.BootStrapper.exe") Then
Show "Found " + f1.Path + "\Common.Starter.BootStrapper.exe",0
Show "Removing " + f1.Path,1
f1.Delete
End If
End If
Else
If (StrComp(Right(f1.name,4),".tmp") = 0 ) Then
If (StrComp(Left(f1.name,3),"VSD") = 0) Then
If (fso.FolderExists(f1.Path + "\PreCheck")) Then
Show "Found " + f1.Path + "\PreCheck",0
Show "Removing " + f1.Path,1
f1.Delete
End If
End If
End IF
End If
End if
Next
End Function
Function CleanUpDir(directory)
If fso.FolderExists(directory) Then
Show "Removing """ & directory & """ ...",1
WshShell.Run "cmd /c rmdir /s /q """ & directory & """",0,true
End If
End Function
Function Show(msg,mode)
'mode 0 - echo in cscript only, 1 - pop up for wscript,
'mode 2 - MsgBox (ok/cancel) in wscript
'mode 3 - MsgBox (yes/no) in wscript
'mode 1,2 skip in /silent mode
LogMsg msg
If (Instr(WScript.FullName,"wscript.exe") > 0) Then
Select Case mode
Case 1:
If Not (isSilent) Then
WshShell.PopUp msg,2, "Space Setup",64
End If
Case 2: 'MsgBox 289 -> OK/Cancel
If Not (isSilent) Then
If (MsgBox (msg,289,"Space Setup") = 2 ) Then
LogMsg "Canceled by user"
LogMsg "Removing client quit at " & Now & " <<<"
WScript.Quit (1)
End If
End If
Case 3:
If (noPrompt) Then
LogMsg "Silent Unistallation triggered"
else
'MsgBox 292 -> Yes/No
If (MsgBox (msg,292,"Space Setup") = 7 ) Then
LogMsg "Canceled by user"
LogMsg "Removing client quit at " & Now & " <<<"
WScript.Quit (1)
End If
End If
Case 4: 'MsgBox 64 -> Info OK
MsgBox msg,64,"Space Setup"