Solved

Application Start

Posted on 2006-11-24
5
260 Views
Last Modified: 2008-02-01
Im trying to start a program via my vb.net application, but I cant get it to work, I have tried to 2 methods, but both say they cant find the path, it works without the program arguments, but as soon as I put them in it fails, anyone have any idea whats going on?

Shell("C:\Program Files\xampp\mysql\bin\mysqldump -B --user=root --password=password --host=localhost myDatabase >c:\Backups\mysql\2006\11\24\personal\File14.txt")

System.Diagnostics.Process.Start("C:\Program Files\xampp\mysql\bin\mysqldump -B --user=root --password=password --host=localhost myDatabase >c:\Backups\mysql\2006\11\24\personal\File14.txt")

Tony
0
Comment
Question by:tonelm54
  • 4
5 Comments
 
LVL 13

Accepted Solution

by:
newyuppie earned 500 total points
ID: 18009524
try this method

with imports System.Diagnostics


Dim oInfo As New ProcessStartInfo
Dim p As Process
dim MyComm as string = "-B --user=root --password=password --host=localhost myDatabase >c:\Backups\mysql\2006\11\24\personal\File14.txt"

oInfo.FileName = "C:\Program Files\xampp\mysql\bin\mysqldump"
oInfo.Arguments = MyComm
p = Process.Start(oInfo)

NY
0
 

Author Comment

by:tonelm54
ID: 18009615
Works but doenst dump the file into a text file after.
0
 

Author Comment

by:tonelm54
ID: 18009617
the bit >c:\Backups\mysql\2006\11\24\personal\File14.txt should dump the output into a text file
0
 

Author Comment

by:tonelm54
ID: 18009620
on reading up on it, seems like I need to use streams, but have no ideas, anyone have any examples?
0
 

Author Comment

by:tonelm54
ID: 18009738
Sorted, if anyones interested heres the code:-
   Public Function GetProcessText(ByVal process As String, _
                                          ByVal param As String, _
                                          ByVal workingDir As String) _
                                          As String
        Dim p As Process = New Process
        ' this is the name of the process we want to execute
        p.StartInfo.FileName = process
        If Not (workingDir = "") Then
            p.StartInfo.WorkingDirectory = workingDir
        End If
        p.StartInfo.Arguments = param
        p.StartInfo.UseShellExecute = False
        p.StartInfo.RedirectStandardOutput = True
        p.StartInfo.CreateNoWindow = True
        p.Start()
        Dim output As String = p.StandardOutput.ReadToEnd
        p.WaitForExit()
        Return output
    End Function
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question