Command Line Execution 
Author Message
 Command Line Execution

Forgive my ignorance, but I am interested in being able to run, and capture
the output of, DOS commands from within a VC++ Application.

I'll explain further:

I would like a program (possibly from a Win32 Console Application) to
perform a dos command as simple as "DIR /B" and capture the output, then be
able to parse the output and create a customized file to write to the hard
disk.

Thanks in advance.

-Sarlaton



Wed, 02 Aug 2000 03:00:00 GMT  
 Command Line Execution

A simple solution would be to do one of the following:

1) Just use the WIN32 API calls FindFirstFile, FindNextFile, and FindClose
to
do the same thing as a "DIR /B" would do.

2) Write the output to a temp file (i.e. DIR /B > D:\TEMP\DIR00001.TMP)
where the
filename is one generated from GetTempFilename and GetTempPath.

(#1 is a better way to do this.)

Quote:

>Forgive my ignorance, but I am interested in being able to run, and capture
>the output of, DOS commands from within a VC++ Application.

>I'll explain further:

>I would like a program (possibly from a Win32 Console Application) to
>perform a dos command as simple as "DIR /B" and capture the output, then be
>able to parse the output and create a customized file to write to the hard
>disk.

>Thanks in advance.

>-Sarlaton



Thu, 03 Aug 2000 03:00:00 GMT  
 Command Line Execution

Quote:
>I would like a program (possibly from a Win32 Console Application) to
>perform a dos command as simple as "DIR /B" and capture the output, then be
>able to parse the output and create a customized file to write to the hard
>disk.

Sarlaton,

Have a look for the topic titled "Creating a Child Process with
Redirected Input and Output" in your VC or MSDN help.

Dave
----
Address is altered to discourage junk mail.
Remove ".---" for the real address.



Thu, 03 Aug 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Newbie Question - command line execution

2. Command line execution from code

3. Background Command-Line Execution

4. preventing the logo and command line from being printed during command line build

5. How to execute a DOS Command (command line)

6. Replacing resources of an EXE file using command line commands

7. Command line parameters with line feeds???

8. The resulting recordset of a command object execution is always read-only

9. hiding a command execution

10. HELP: Execution skips lines??

11. Visual C/C++ line of execution

12. Execution Line Count Profiler

 

 
Powered by phpBB® Forum Software