Solved

Application Start

Posted on 2006-11-24
5
256 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
Comment Utility
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
Comment Utility
Works but doenst dump the file into a text file after.
0
 

Author Comment

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

Author Comment

by:tonelm54
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now