Thursday, April 28, 2011

How can i run an exe file in a specified path from VB.NET or C#.NET(windows applications)

Hi guys,

First I am running the below Command "mysqldump.exe --user=root --password=root accounts>accounts.sql" in the path C:>, to take backup, but it show error message "mysqldump is not a recognized command".

Then i changed the path in command prompt using the cd command to the location "C:\Program Files\MySQL\MySQL Server 5.0\bin>"

Now i am running the below command.

C:\Program Files\MySQL\MySQL Server 5.0\bin> mysqldump.exe --user=root --password=root accounts>accounts.sql

It is successfully working, but how can i achieve this work from VB.NET or C#.NET.

From stackoverflow
  • Not quite sure what you are asking, but the following, runs the mysqldumb.exe with the parameters you specified. (C#)

    Process.Start(@"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump.exe", "--user=root --password=root accounts>accounts.sql")
    
  • You mean changing the current path? Here's the C# code to do it ...

    Directory.SetCurrentDirectory(@"C:\Program Files\MySQL\MySQL Server 5.0\bin");
    

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.