I'm not sure I fully understand why you care about capturing the output 
if you don't really need to analyze what's coming back from the command.

But you can always try some of the following.

In NT, you can usually send data to a command line in two ways, 
which, to say the truth, may not work in all cases nor with all programs. 
You've got to experiment a bit.

One way is to echo something and pipe it to a command, such as in 

echo Y | del %TEMP%

You can redirect STDOUT if you want to, the command just doesn't 
care at all :

echo Y | del %TEMP% > nul 2>&1


Another way, and this can be useful if you need to provide more that one 
answer, is to redirect the content of a file to a command :

command < myfile > nul 2>&1 

or 

type myfile | command > nul 2>&1


where myfile contains the proper answers to the prompts that 
will be emitted by 'command', one on each line, to provide the 
return character. 
Empty lines can play the return char. only. 
I've seen cases where you needed to manually add the return 
char. (ASCII 13), that not all editors can handle with grace. 

In Perl, you can provide input to a process or capture output, but as 
you mention, not both at once. What you might be able to do though, 
is prompt the user via Perl (if you need to), then check and write the 
answers to a file which you can then redirect to your command, if it 
will accept that.

Not the most elegant solution, but it might work.

In fact, it might be easier to open the filehandle to write to the process 
while redirecting the whole output to a file, then read the content of that 
file when all is finished, if you need some kind of return information.

Give this a try and let us know.

_____________________________________________
Bruno Bellenger
Sr. Network/Systems Administrator 

        -----Original Message-----
        From:   Clint Mahoney [SMTP:[EMAIL PROTECTED]]
        Sent:   Monday, May 22, 2000 18:08
        To:     Perl-Win32-Users Mailing List
        Subject:        STDIN and STDOUT

                Is there a way to open a process as a filehandle that
captures
        STDOUT and lets you send STDIN at the same time?  I know how to do
both
        separately.
                I need to send data to a command at the command line that
answers
        two prompts.  I guess I don't really need to analyze what's coming
back
        from the command but I definitely need to be able to send two pieces
of
        data in answer to the two prompts.  Surely there's some way.  
                Thanks in advance - everyone on this mailing list is so
helpful!

                                                        -Clint


        ---


---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to