Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Many

i have found a solution

ok, this is my solution. :lol:
            ' Run hidden WinSCP process

            Dim winscp As Process = New Process()
            winscp.StartInfo.FileName = "winscp.com"
            winscp.StartInfo.Arguments = "/command ""option batch on"" ""Option Confirm Off"" ""open " & user & ":" & pw & "@" & adress & """" & remoteDir & " ""Option transfer binary"" ""Get " & remotePattern & " " & localDir & "*"" ""close"" ""exit"""
            winscp.StartInfo.UseShellExecute = False
            winscp.StartInfo.RedirectStandardInput = True
            winscp.StartInfo.RedirectStandardOutput = True
            winscp.StartInfo.CreateNoWindow = True
            winscp.Start()

            ' Wait until WinSCP finishes
            winscp.WaitForExit()

            'Falls Anmeldungsfehler (z.b. Host nicht gefunden oder Passwort nicht korrekt)
            If winscp.ExitCode <> 0 Then

                ' Collect all output (not used in this example)
                'Hier werden die Erfolgs oder Errormeldungen ausgegeben.
                Dim errorOutput As String = winscp.StandardOutput.ReadToEnd()

                usefulFunctions.logMessage(errorOutput, "ERROR", "downloader.SFTP")
                Return False

            End If
Many

How can i get the Error Message?

I want to get an error message in vb.net, when i as example are not logged or have the wrong password. how can i get that? is that possible?

here is my code.

    ' New ProcessStartInfo created

            Dim p As New ProcessStartInfo

            'Specify the location of the binary
            p.FileName = Application.StartupPath & "\WinSCP.com"

            ' Use these arguments for the process
            p.Arguments = "/command ""option batch on"" ""Option Confirm Off"" ""open " & user & ":" & pw & "@" & adress & """" & remoteDir & " ""Option transfer binary"" ""Get " & remotePattern & " " & localDir & "*"" ""close"" ""exit"""


            'Use a hidden window
            p.WindowStyle = ProcessWindowStyle.Hidden

            ' Start the process
            Dim process1 As Process = Process.Start(p)

            'Dim output As String = process1.StandardOutput.ReadToEnd()

            'warten bis der Process beendet wird.
            process1.WaitForExit()