Page 1 of 1

Write Run Program output to text file

Posted: Wed May 27, 2009 3:30 am
by anj2005
Hi,

I want to use the output of a Run Program command to write to a text file. Specifically, I want to call mysqldump and write to a .sql file in order to back up the program's database. I am calling the command:
mysqldump -[all the parameters] > filename.sql.

If I don't add the > filename.sql, then I can see the cmd box with the proper script results flowing through so I know the mysqldump command is executing. But adding the > filename.sql gives me no result. The file does not save to the mysqldump directory. Even if I specify a full path such as > C:\\filename.sql no file shows up either.

How can I get the Run Program output to write to a file?

Thanks
Alex




[quote][/quote]

Posted: Wed May 27, 2009 5:20 am
by MichaelNesmith
Output redirection/piping is not a feature of the CreateProcess/ShellExecute Windows APIs that Run Program uses, but a part of the cmd.exe system shell interpreter.

You will want to run cmd.exe directly instead! See the sticky post in this forum.

Posted: Wed May 27, 2009 12:48 pm
by anj2005
Using cmd with the /c option worked.

Thanks!
Alex