I am using the ‘ShellExecute’ function in windows vista
Is there any way to pipe the output to a file?
i.e.
MySqlDump.exe '-u user1 -ppassword dbName > TheOutputFile.Sql
Here my code
theProgram := 'MySqlDump.exe';
itsParameters := '-u user1 -ppassword dbName';
rslt := ShellExecute(0, 'open',
pChar (theProgram),
pChar (itsParameters),
nil,
SW_SHOW);
EDIT:
I have tried
itsParameters := '-u user1 -ppassword dbName > TheOutputFile.Sql';
but this does not work
@Charles, you can use the redirector simbol ">" in a ShellExecute, but using the cmd.exe which is the Windows command interpreter.
try this sample
ShellExecute(0,nil,'cmd.exe','/c MySqlDump.exe -u user1 -ppassword dbName > TheOutputFile.Sql',nil,sw_normal);
Another options is use pipes, you can find a very nice example in this link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With