[Problem] vb.net 2012 cmd auslesen lassen

01/22/2013 20:33 pixelz#1
Ich habe das Problem das ich die openssl.exe die ja über die eingabeaufforderung startet auslesen möchte, und den Inhalt dessen soll er in eine Textbox packen. Bei den 2 versuchen die ich gemacht habe, hat er nur die openssl.exe gestartet ohne inhalt.

Es entsteht ein leeres Cmd fenster ohne Inhalt, wie behebe ich mein Problem?

ich habs auf 2 Weisen Probiert gehabt:

[Only registered and activated users can see links. Click Here To Register...]

oder

Dim p As New Process()
p.StartInfo.FileName = "openssl.exe"
p.StartInfo.Arguments = " -help"
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.CreateNoWindow = True
Dim sOutput As String
p.Start()
sOutput = p.StandardOutput.ReadToEnd()
p.WaitForExit()
p.Close()
MessageBox.Show(sOutput)

Beides ging nicht, bei einen normalen Shell befehl klappt alles ohne Probleme, es taucht nur das nervige Fenster im Hintergrund auf und er gibt den wert nicht in der textbox wieder.

Wie kann ich das ganze bewerkstelligen?
01/23/2013 18:09 Shawak#2
Code:
Dim info as new StartInfo
info.FileName = "openssl.exe"
info.Arguments = " -help"
info.UseShellExecute = False
info.RedirectStandardOutput = True
info.CreateNoWindow = True

Dim p as new Process(info)
Dim sOutput As String
p.Start()
sOutput = p.StandardOutput.ReadToEnd()
p.WaitForExit()
p.Close()
MessageBox.Show(sOutput)
01/23/2013 22:43 pixelz#3
so nach etwas googeln bin ich drauf gekommen...

Code:
        Dim p As New Process()
        p.StartInfo.FileName = "cmd"
        p.StartInfo.Arguments = ("/c " & Openssl_Pfad)
        p.StartInfo.UseShellExecute = False
        p.StartInfo.RedirectStandardOutput = True
        p.StartInfo.RedirectStandardError = True
        p.StartInfo.CreateNoWindow = False
        Dim sOutput As String
        p.Start()
        sOutput = p.StandardOutput.ReadToEnd()
        sOutput = p.StandardError.ReadToEnd()
        p.WaitForExit()
        p.Close()
        Fehlerausgabe.Text = sOutput

das /c und
p.StartInfo.RedirectStandardError = True
p.StandardError.ReadToEnd

haben gefehlt

#Closerequest