[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Application Start

Posted on 2006-11-24
5
Medium Priority
?
269 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

656 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