Re:Execute a dos command
Quote
pivo wrote:
> Can anybody tell me how to execute a dos command?
system will do it, but it will print the results to the console. If you are in a GUI
app, I think it may even popup a console window to run in. If you need to capture the
output of a dos command, then you should use CreateProcess to launch cmd.exe or
command.com. cmd.exe has a /c switch that allows you to pass in the command. for
exeample:
cmd.exe /c dir
is equivalent to running dir at the command prompt.
To capture the output of dir, you would need to create some unnamed pipes and pass
those pipes to CreateProcess. How to capture the output of a program is a separate
topic. Post a question to the winapi group if you need help on that.
Harold Howe [TeamB]
http://www.bcbdev.com