Wenn dies dein verwendeter Code ist, auch kein Wunder, den dort wird die genannte Funktion nicht angewendet:
Bei dir muss es wie folgt aussehen
PS: Wenn die Text beim Beenden des Progs geschrieben wird, Starte das Prog aus Basic heraus, versteckt, und führe nur den taskkill Befehl über die Batch aus.
Bei dir muss es wie folgt aussehen
VB.NET-Quellcode
- Class Form1
- Public Shared Sub RunHiddenExecutable(ByVal strFileName As String, ByVal strArguments As String, ByVal blnWaitForExit As Boolean, ByVal strLogPath As String)
- Dim blnOutputLogFile As Boolean = True
- If strLogPath Is Nothing OrElse strLogPath.Length = 0 Then
- blnOutputLogFile = False
- End If
- Dim sb As New System.Text.StringBuilder()
- Try
- Dim psi As New ProcessStartInfo()
- psi.WindowStyle = ProcessWindowStyle.Hidden
- psi.CreateNoWindow = True
- psi.FileName = strFileName
- psi.Arguments = strArguments
- psi.UseShellExecute = False
- psi.RedirectStandardOutput = True
- Dim p As Process = System.Diagnostics.Process.Start(psi)
- sb.Append(p.StandardOutput.ReadToEnd())
- If blnWaitForExit Then
- p.WaitForExit()
- End If
- Catch ex As Exception
- sb.Append("Exception Occured:" & Constants.vbCrLf)
- sb.Append(ex.ToString())
- Throw
- End Try
- End Sub
- Sub Form_Load(ByVal .. hier das übliche) As Me.Handles
- RunHiddenExecutable("C:\Pfad\zur\batch\start.bat", "", false, Nothing)
- System.Threading.Thread.Sleep(900)
- RunHiddenExecutable("C:\Pfad\zur\batch\end.bat", "", false, Nothing)
- End Sub
- End Class
PS: Wenn die Text beim Beenden des Progs geschrieben wird, Starte das Prog aus Basic heraus, versteckt, und führe nur den taskkill Befehl über die Batch aus.