Piping data to a file with the windows ‘ShellExecute’ function
delphi, shellexecute, windows
Solution
@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.
Problem
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