Ho provato ma come immaginavo con scarsi successi.
Il codice che ho scritto, in un file chiamato "prova.vbs", e' questo:

codice:
Private Const PROCESS_QUERY_INFORMATION = &H400
Private Const STATUS_PENDING = &H103&

Private Declare Function OpenProcess Lib "kernel32" _
    (ByVal dwDesiredAccess As Long, _
    ByVal bInheritHandle As Long, _
    ByVal dwProcessId As Long) As Long

Private Declare Function GetExitCodeProcess Lib "kernel32" _
    (ByVal hProcess As Long, lpExitCode As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" _
    (ByVal hObject As Long) As Long



Private Sub ShellAndWait(sFile As String, Visualizzazione As Long)
Dim hProcess As Long
Dim ProcessId As Long
Dim CodExit As Long

    ProcessId = Shell(sFile, Visualizzazione)
    hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId)
    Do
        Call GetExitCodeProcess(hProcess, CodExit)
        DoEvents
    Loop While CodExit = STATUS_PENDING

    Call CloseHandle(hProcess)
End Sub



ShellAndWait "C:\Temp\prova.bat", vbnormalfocus
Ovviamente il file "C:\Temp\prova.bat" contiene un semplice comando, tanto per provarlo:

codice:
 
echo on
echo PROVA
pause
L'errore che ricevo e' il seguente:

Script: prova.vbs
Riga : 4
Carattere: 17
Errore: Prevista fine istruzione
Codice: 800A0401
Origine: Errore di compilazione di Microsoft VBScritp

Puoi aiutarmi ancora?

Grazie
Wdb