MysqlDump 出现 ShellExecute 错误

标签 mysql visual-c++ mfc shellexecute

当我尝试执行时

mysqldump --host="ean13.info"--user="user"--password="mypass"info_upm > c:\\mysql.sql 通过 Visual C++ 中的 ShellExecute 我收到

mysqldump ERROR: can not find table ">".

通过命令行执行该命令即可。我知道“>”字符会发生一些事情,但找不到什么。

最佳答案

ShellExecute 旨在执行 .exe(在您的情况下为 mysqldump),而您尝试使用它来重定向标准输出到文件。使用 ShellExecute 无法做到这一点。

CreateProcess是一个更好的选择,可能使用管道进行重定向,或者可能 ReadConsole

参见:

  1. > Redirecting stdout output in cpp
  2. > How do I redirect output to a file with CreateProcess?

关于MysqlDump 出现 ShellExecute 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40638790/

相关文章:

mysql - 最佳数据库,NOSQL 与 MySQL

php - mysql从表中获取用户最高出价

c++ - sqlConnection->Open() 不起作用

visual-c++ - 未捕获整数除以零异常

php - 如何在 Laravel 5.6 中动态地向数据库添加列

php 论坛在提交时未检测到新行

c++ - move 语义在哪里有益的好例子

c++ - LoadLibrary(xx.dll) 错误 126

c++ - Http post - 发送大数据时连接重置 vc++

windows - 旧的 Visual Studio 2017/MFC 应用程序仍然有一个非常旧的 "look"到 Windows