The redirection might work as a parameter in ExecuteFile or Shellexecute.
Here are some extracts from one of my apps that does this
Params are other required parameters for this electrical rules checker utility, this sends the output to the file 'ercop.txt'.
If this dosent work (some DOS programs wont accept it)
Write a batch file and include the redierction then call the batch file from your Delphi appliction.
No dos programs recognize I/O redirection syntax. Never pass a redirect to a dos program!
Redirection is handled by the command interpreter, *NOT* the dos program. A program that reads from stdin and writes to stdout will honor redirection established by dos. A program that uses the Crt module normally does not respect the redirection.
In fact, you can fake I/O redirect with some programming at the assembly level. Intercept reads from stdin and writes to stdout and do with them what you will. (I've written a routine that runs a program inside a window on a dos text screen, while simultaneously saving the data to disk.)
When you use Shellexecute the paramaters are there in an attempt to simulate the action of the command line interpreter!.
No one is suggesting that You are passing a command to the called program that will make it send it's output to file.
The example I gave is part of a working program! Designed to provide a widows interface to a suite of DOS (and some windows programs) It works fine.
The Redirection should being the 'Stdout' location, if the program being called uses stdout then the redirection will work when called in this way.
Commands in a Batch file invoke the command line interpreter. Redirectons should work as if you had typed it in.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.