使用windows‘;ShellExecute’;功能
我正在windows vista中使用“ShellExecute”功能 有没有办法将输出通过管道传输到文件 i、 e MySqlDump.exe'-u user1-ppassword dbName>theoutput文件.Sql 这是我的密码使用windows‘;ShellExecute’;功能,windows,delphi,shellexecute,Windows,Delphi,Shellexecute,我正在windows vista中使用“ShellExecute”功能 有没有办法将输出通过管道传输到文件 i、 e MySqlDump.exe'-u user1-ppassword dbName>theoutput文件.Sql 这是我的密码 theProgram := 'MySqlDump.exe'; itsParameters := '-u user1 -ppassword dbName'; rslt := ShellExecute(0, 'open',
theProgram := 'MySqlDump.exe';
itsParameters := '-u user1 -ppassword dbName';
rslt := ShellExecute(0, 'open',
pChar (theProgram),
pChar (itsParameters),
nil,
SW_SHOW);
编辑:
我试过了
itsParameters := '-u user1 -ppassword dbName > TheOutputFile.Sql';
但这不起作用在这种情况下,最简单的方法(除非使用cmd脚本)可能是使用而不是ShellExecute
或者更好地使用--result file选项创建mysqldump。无法保证此代码或站点的有效性,但我不止一次听说过。今晚回家后我会检查它。@Charles,您可以在ShellExecute中使用重定向程序simbol“>,但使用cmd.exe,它是Windows命令解释器 试试这个样品
ShellExecute(0,nil,'cmd.exe','/c MySqlDump.exe -u user1 -ppassword dbName > TheOutputFile.Sql',nil,sw_normal);
另一个选项是使用管道,您可以在其中找到一个非常好的示例。您应该使用并提供在结构的hStrOutput中创建的管道的一端。有