How can I run an exe file at a specified path from VB.NET or C # .NET (Windows applications)

First, I run the following command "mysqldump.exe --user = root --password = root accounts> accounts.sql" in the C:> path to back up, but it shows the error message "mysqldump is not recognized command".

Then I changed the path on the command line using the cd command to the location "C: \ Program Files \ MySQL \ MySQL Server 5.0 \ bin>"

Now I run the following command.

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

It works successfully, but how can I achieve this work with VB.NET or C # .NET.

+3
source share
2 answers

Not quite sure what you are asking, but the following starts mysqldumb.exe with the parameters you specified. (FROM#)

Process.Start(@"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump.exe", "--user=root --password=root accounts>accounts.sql")
+3
source

Do you want to change the current path? Here is the C # code to do this ...

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

Source: https://habr.com/ru/post/1705462/


All Articles