?
Solved

Application Start

Posted on 2006-11-24
5
Medium Priority
?
267 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
[X]
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
  • 4
5 Comments
 
LVL 13

Accepted Solution

by:
newyuppie earned 2000 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

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

771 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