Retrieving Text from Shell'ed Cmd Prompt Progs

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Retrieving Text from Shell'ed Cmd Prompt Progs

Postby smays » Thu Jul 15, 2010 2:02 pm

I have a batch file (*.bat) that I plan to Shell out to the command line from a program and I would like to retrieve whatever text is returned to the DOS prompt as a result of executing the batch file. I am assuming there are articles, etc... I can read, so I am anticipating some basic direction like that. I have investigated pipes (?), but I got confused.

Thanks,
Steve.
smays
BCBJ Guru
BCBJ Guru
 
Posts: 165
Joined: Tue Sep 18, 2007 11:28 pm
Location: Huntsville, AL

Re: Retrieving Text from Shell'ed Cmd Prompt Progs

Postby gambit47 » Thu Jul 15, 2010 2:19 pm

smays wrote:I have a batch file (*.bat) that I plan to Shell out to the command line from a program and I would like to retrieve whatever text is returned to the DOS prompt as a result of executing the batch file. I am assuming there are articles, etc... I can read, so I am anticipating some basic direction like that. I have investigated pipes (?), but I got confused.


There are NUMEROUS articles available online with full source code, both BCB/VCL- specific and Win32-generic, that explain how to redirect input/output for processes that are launched via the Win32 API CreateProcess() function. Just look around. For instance:

Creating a Child Process with Redirected Input and Output

How to spawn console processes with redirected standard handles

Just to name a couple.
Remy Lebeau (TeamB)
http://www.lebeausoftware.org
User avatar
gambit47
BCBJ Author
BCBJ Author
 
Posts: 472
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: Retrieving Text from Shell'ed Cmd Prompt Progs

Postby smays » Thu Jul 15, 2010 2:44 pm

Thanks! I will study these!

Steve.
smays
BCBJ Guru
BCBJ Guru
 
Posts: 165
Joined: Tue Sep 18, 2007 11:28 pm
Location: Huntsville, AL


Return to Technical

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests

cron