Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用windows‘;ShellExecute’;功能_Windows_Delphi_Shellexecute - Fatal编程技术网

使用windows‘;ShellExecute’;功能

使用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',

我正在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',
                       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中创建的管道的一端。有