oExec.StdOut after pipe Findstr

Discussion in 'Microsoft Windows 2000 CMD Promt' started by Wensi Peng, Jan 7, 2005.

  1. Wensi Peng

    Wensi Peng Guest

    Hello,

    Can Exec object read lines from standard out after a pipe in command-line?
    Below is my script. After I added |findstr in the command-line oExec does
    not read anything from screen.

    Any tips?

    Thanks,
    Wensi


    strCommand = "%comspec% /c ping -n 1 " & strComputer & "|findstr /i ""reply
    timed unknown"""
    set oExec = Wshshell.Exec (strCommand)
    Do Until oExec.StdOut.atEndofStream
    Wscript.Echo oExec.StdOut.Readline & " , " & Ucase(strComputer)
    Loop
     
    Wensi Peng, Jan 7, 2005
    #1
    1. Advertisements

  2. Wensi Peng wrote:
    > Hello,
    >
    > Can Exec object read lines from standard out after a pipe in command-line?
    > Below is my script. After I added |findstr in the command-line oExec does
    > not read anything from screen.
    >
    > Any tips?
    >

    Yes, try it.
    If you get unexpected results or an error message come back again.
    You don't expect us to test it for you, right?

    I think Ray Constanzo pointed you here for batch question not for
    vbscript ones.

    --
    Gruesse Greetings Saludos Saluti Salutations
    Matthias
    ---------+---------+---------+---------+---------+---------+---------+
     
    Matthias Tacke, Jan 7, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.