Ho lanciato i comandi DISM e SFC /scannow, il primo mi ha detto che e' tutto regolare, il secondo ha trovato dei file corrotti e li ha sistemati.
Riavviato il pc.
Ho commentato nel mio script le due linee
Set oShell = Nothing
Set oShellExec = Nothing
adesso funziona la parte che ho riportato qui sul forum, ma se eseguo quello completo si chiude e non continua ed andando a vedere gli eventi riporta sempre quell'errore BEX64.
lo script completo e' questo:
codice:
'calcolo l'md5 del file che ho scaricato
Dim hashDownload
cartellaDownload = "W:\backup\S\"
ultimoFile = GetRecentFile(cartellaDownload, "7z")
hashDownload = Trim( left( getHashMD5(ultimoFile), 33))
hashMail = removeSpace( InputBox ("Inserire l'hash preso dalla mail") )
if UCase(hashMail) = hashDownload Then
MsgBox "OK hash corrispondenti "& vbCrlf & ultimoFile
Else
MsgBox "hash errati"& vbCrlf & ultimoFile
end if
call verifica7zip( ultimoFile )
call Apri(cartellaDownload)
call Apri(cartellaDownload & "logBackup.txt")
Wscript.Quit
'*************************************************************************
'****************************** FINE SCRIPT ******************************
'*************************************************************************
Function getHashMD5(filename)
Set oShell = CreateObject("WScript.Shell")
Set oShellExec = oShell.Exec("./md5.exe """ & filename & """ ")
If oShellExec.Status = 0 Then
getHashMD5 = oShellExec.StdOut.ReadAll
msgbox "QUI"
Else
getHashMD5 = "Failed with Error " & oShellExec.Status & vbNewLine & oShellExec.StdErr.ReadAll
msgbox "NO"
End If
'Set oShellExec = Nothing
'Set oShell = Nothing
End Function
Function GetRecentFile(path, fileExtension)
Dim fso, file
Set fso = CreateObject("Scripting.FileSystemObject")
Set GetRecentFile = Nothing
For Each file in fso.GetFolder(path).Files
if lcase(File.Name) <> lcase("Thumbs.db") And LCase(fso.GetExtensionName(file.Name)) = LCase(fileExtension) Then
If GetRecentFile is Nothing Then
Set GetRecentFile = file
ElseIf file.DateLastModified > GetRecentFile.DateLastModified Then
Set GetRecentFile = file
End If
end if
Next
'Set fso = Nothing
End Function
Function removeSpace( stringa )
removeSpace = Replace(stringa, " ", "")
End Function
Sub verifica7zip(fileDaVerificare)
Set WshShell = CreateObject("Wscript.Shell")
cmd = "7z.exe t "& fileDaVerificare
cmd = "%comspec% /c ""7z.exe t "& fileDaVerificare &" & pause"""
'msgbox cmd
WshShell.Run cmd, 1, true
'Set WshShell = Nothing
End Sub
Sub Apri(cartellaDaAprire)
Dim SH
Set SH = WScript.CreateObject("WScript.Shell")
SH.Run cartellaDaAprire
'Set SH = Nothing
End Sub