bat ausführen

  • VB.NET

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von Gugi.

    bat ausführen

    Hallo,

    weiß jemand wie man eine batch ausführt?
    Erstellt habe ich sie so:

    VB.NET-Quellcode

    1. Using sw As New IO.StreamWriter(Application.StartupPath & "xbackup_tempfile2.bat")
    2. sw.Write("xcopy.exe " & TextBox1.Text & " " & TextBox2.Text & " /D /E /Y /I")
    3. End Using





    und nun will ich sie ausführen:



    VB.NET-Quellcode

    1. Process.Start("xbackup2_tempfile.bat")




    doch irgendwie wird die .bat nicht direkt im Programmordner erstellt sondern im Überordner erstellt und so bekomme ich beim ausführen nur eine fehlermeldung.
    Bilder
    • Aufzeichnen.PNG

      23,95 kB, 438×291, 83 mal angesehen

    Dieser Beitrag wurde bereits 4 mal editiert, zuletzt von „F@bian“ ()

    glaub du musst statt:

    VB.NET-Quellcode

    1. Using sw As New IO.StreamWriter(Application.StartupPath & "xbackup_tempfile2.bat")
    2. sw.Write("xcopy.exe " & TextBox1.Text & " " & TextBox2.Text & " /D /E /Y /I")
    3. End Using

    VB.NET-Quellcode

    1. Using sw As New IO.StreamWriter(Application.StartupPath & "\xbackup_tempfile2.bat")
    2. sw.Write("xcopy.exe " & TextBox1.Text & " " & TextBox2.Text & " /D /E /Y /I")
    3. End Using

    lg Gugi