Trouble passing arguments to System.Diagnostics.Process.Start
-
Hi all! I have trouble passing arguments to the Process.Start in VB.NET. What I want to accomplish is to backup a mysql database with its mysqldump.exe which is located in my C drive. I have a code that can do it perfectly when run in the command prompt. The problem if face comes when I want to pass that same code to the process.start. The code that does the work is :
"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe" --user=root --password=mypassword --host=localhost --port=3306 --database sakila > "C:\backup\sakilabackup.sql"""
To be sure, I broke the code into two blocks, and I placed them to two textboxes as follows:
txtProgram.Text = "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe" ,
txtArguments.Text= "--user=root --password=mypassword --host=localhost --port=3306 --database sakila >"C:\backup\sakilabackup.sql"""
Then I did this:
System.Diagnostics.Process.Start(txtProgram.Text, txtArguments.Text)
And it still bring me the error "The system cannot find the file specified" Error message. Can you please tell me what the problem is and how I can get through it? Please remember that, if I take the contents of txtProgram.text and txtArguments.text and put them to a command prompt, it works fine. *I have also searched other threads here, no one had an exact similar issue like mine. I will appreciate any help. (I use VB 2010)