Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Application Start

Posted on 2006-11-24
5
261 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

861 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