Windows Vista Forums

Problem with WSH Shell Exec StdOut

  1. #1


    Paul Randall Guest

    Problem with WSH Shell Exec StdOut

    I'm trying to Use WSH Shell Exec to run a 'command line' program and catch
    its StdOut stream in real time. I'm using Nero's NeroCmd.exe to read,
    write, erase, and get info about a CD-RW in drive F:. I'm running WXP Pro
    SP2. NeroCmd.exe is a command line utility included with or usable with
    most versions of Nero in the past 5 or more years, including the free
    versions included with many CD/DVD writers, I think.

    If I create and run a .bat file with the following on a single line:
    C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    7\Core\NeroCmd.exe" --erase -- drivename f

    then almost immediately I get a command window displaying the following:
    C:\Program Files\Windows Resource Kits\Tools>%comspec% /c "C:\Pr\Nero
    7\Core\NeroCmd.exe" --erase --drivename f
    Erasing disc. This will take 61 seconds.

    and after about a minute an "OK." message appears and the command window
    closes.

    The batch file runs differently if Shell Exec'ed.
    Here is the script I'm currently using:
    '-------------
    Dim WshShell, oExec, input
    Set WshShell = CreateObject("WScript.Shell")
    Set oExec = WshShell.Exec("test2b.bat")

    Do While True
    input = "At End Of Stream!"
    Do while Not oExec.StdOut.AtEndOfStream
    input = Replace(input, "At End Of Stream!", "")
    input = input & oExec.StdOut.Read(1)
    'Display each line as it is received.
    If InStr(input, vbcrlf) <> 0 Then Exit Do
    WScript.Sleep 0
    Loop
    MsgBox "*" & input & "*"
    WScript.Sleep 10
    Loop
    '-------------

    Sorry about the endless loop. You have to abort the script by ending the
    wscript.exe in windows task manager.

    If I use the VBScript above to use the shell object's exec method to run the
    script, and to read and display the exec method's StdOut stream in real
    time, I immediately get the following:

    1: a message box with two asterisks indicating a vbCrLf was received.

    2: a message box containing the command:
    *C:\Documents and Settings\Paul\My Documents\vbScript\Nero Command
    Line>C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    7\Core\NeroCmd.exe" --erase --drivename f *

    3. after about a minute, I get two more message boxes:

    *Erasing disc. This will take 61 seconds.*

    and

    *Ok.*

    and an infinite number of *At End Of Stream!* messages.

    To me, this indicates that I am not getting StdOut in real time; the 'this
    will take 61 seconds' should have occurred almost immediately rather than
    after the erase process was about done.

    Is there some change I can make to the script to get the info in real time,
    or is it likely that NeroCmd.exe handles StdOut differently when its batch
    file is Shell Exec'ed than when run in a plain command line window, and I
    just have to live with it?

    Thanks for any help you can give me.

    -Paul Randall



      My System SpecsSystem Spec

  2.   


  3. #2


    Pegasus \(MVP\) Guest

    Re: Problem with WSH Shell Exec StdOut


    "Paul Randall" <paulr90@xxxxxx> wrote in message
    news:O9DbWTyeJHA.4180@xxxxxx

    > I'm trying to Use WSH Shell Exec to run a 'command line' program and catch
    > its StdOut stream in real time. I'm using Nero's NeroCmd.exe to read,
    > write, erase, and get info about a CD-RW in drive F:. I'm running WXP Pro
    > SP2. NeroCmd.exe is a command line utility included with or usable with
    > most versions of Nero in the past 5 or more years, including the free
    > versions included with many CD/DVD writers, I think.
    >
    > If I create and run a .bat file with the following on a single line:
    > C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    > 7\Core\NeroCmd.exe" --erase -- drivename f
    >
    > then almost immediately I get a command window displaying the following:
    > C:\Program Files\Windows Resource Kits\Tools>%comspec% /c "C:\Pr\Nero
    > 7\Core\NeroCmd.exe" --erase --drivename f
    > Erasing disc. This will take 61 seconds.
    >
    > and after about a minute an "OK." message appears and the command window
    > closes.
    >
    > The batch file runs differently if Shell Exec'ed.
    > Here is the script I'm currently using:
    > '-------------
    > Dim WshShell, oExec, input
    > Set WshShell = CreateObject("WScript.Shell")
    > Set oExec = WshShell.Exec("test2b.bat")
    >
    > Do While True
    > input = "At End Of Stream!"
    > Do while Not oExec.StdOut.AtEndOfStream
    > input = Replace(input, "At End Of Stream!", "")
    > input = input & oExec.StdOut.Read(1)
    > 'Display each line as it is received.
    > If InStr(input, vbcrlf) <> 0 Then Exit Do
    > WScript.Sleep 0
    > Loop
    > MsgBox "*" & input & "*"
    > WScript.Sleep 10
    > Loop
    > '-------------
    >
    > Sorry about the endless loop. You have to abort the script by ending the
    > wscript.exe in windows task manager.
    >
    > If I use the VBScript above to use the shell object's exec method to run
    > the script, and to read and display the exec method's StdOut stream in
    > real time, I immediately get the following:
    >
    > 1: a message box with two asterisks indicating a vbCrLf was received.
    >
    > 2: a message box containing the command:
    > *C:\Documents and Settings\Paul\My Documents\vbScript\Nero Command
    > Line>C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    > 7\Core\NeroCmd.exe" --erase --drivename f *
    >
    > 3. after about a minute, I get two more message boxes:
    >
    > *Erasing disc. This will take 61 seconds.*
    >
    > and
    >
    > *Ok.*
    >
    > and an infinite number of *At End Of Stream!* messages.
    >
    > To me, this indicates that I am not getting StdOut in real time; the 'this
    > will take 61 seconds' should have occurred almost immediately rather than
    > after the erase process was about done.
    >
    > Is there some change I can make to the script to get the info in real
    > time, or is it likely that NeroCmd.exe handles StdOut differently when its
    > batch file is Shell Exec'ed than when run in a plain command line window,
    > and I just have to live with it?
    >
    > Thanks for any help you can give me.
    >
    > -Paul Randall
    Since you already have a working single-line batch file, what might be the
    purpose of creating a 15-line VB Script file to invoke it? If you must use a
    VB Script, wouldn't it be more consistent to invoke NeroCmd.exe from within
    the VB Script? It would certainly facilitate installation and maintenance!



      My System SpecsSystem Spec

  4. #3


    Paul Randall Guest

    Re: Problem with WSH Shell Exec StdOut


    "Pegasus (MVP)" <I.can@xxxxxx> wrote in message
    news:%230$atZyeJHA.4528@xxxxxx

    >
    > "Paul Randall" <paulr90@xxxxxx> wrote in message
    > news:O9DbWTyeJHA.4180@xxxxxx

    >> I'm trying to Use WSH Shell Exec to run a 'command line' program and
    >> catch its StdOut stream in real time. I'm using Nero's NeroCmd.exe to
    >> read, write, erase, and get info about a CD-RW in drive F:. I'm running
    >> WXP Pro SP2. NeroCmd.exe is a command line utility included with or
    >> usable with most versions of Nero in the past 5 or more years, including
    >> the free versions included with many CD/DVD writers, I think.
    >>
    >> If I create and run a .bat file with the following on a single line:
    >> C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    >> 7\Core\NeroCmd.exe" --erase -- drivename f
    >>
    >> then almost immediately I get a command window displaying the following:
    >> C:\Program Files\Windows Resource Kits\Tools>%comspec% /c "C:\Pr\Nero
    >> 7\Core\NeroCmd.exe" --erase --drivename f
    >> Erasing disc. This will take 61 seconds.
    >>
    >> and after about a minute an "OK." message appears and the command window
    >> closes.
    >>
    >> The batch file runs differently if Shell Exec'ed.
    >> Here is the script I'm currently using:
    >> '-------------
    >> Dim WshShell, oExec, input
    >> Set WshShell = CreateObject("WScript.Shell")
    >> Set oExec = WshShell.Exec("test2b.bat")
    >>
    >> Do While True
    >> input = "At End Of Stream!"
    >> Do while Not oExec.StdOut.AtEndOfStream
    >> input = Replace(input, "At End Of Stream!", "")
    >> input = input & oExec.StdOut.Read(1)
    >> 'Display each line as it is received.
    >> If InStr(input, vbcrlf) <> 0 Then Exit Do
    >> WScript.Sleep 0
    >> Loop
    >> MsgBox "*" & input & "*"
    >> WScript.Sleep 10
    >> Loop
    >> '-------------
    >>
    >> Sorry about the endless loop. You have to abort the script by ending the
    >> wscript.exe in windows task manager.
    >>
    >> If I use the VBScript above to use the shell object's exec method to run
    >> the script, and to read and display the exec method's StdOut stream in
    >> real time, I immediately get the following:
    >>
    >> 1: a message box with two asterisks indicating a vbCrLf was received.
    >>
    >> 2: a message box containing the command:
    >> *C:\Documents and Settings\Paul\My Documents\vbScript\Nero Command
    >> Line>C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    >> 7\Core\NeroCmd.exe" --erase --drivename f *
    >>
    >> 3. after about a minute, I get two more message boxes:
    >>
    >> *Erasing disc. This will take 61 seconds.*
    >>
    >> and
    >>
    >> *Ok.*
    >>
    >> and an infinite number of *At End Of Stream!* messages.
    >>
    >> To me, this indicates that I am not getting StdOut in real time; the
    >> 'this will take 61 seconds' should have occurred almost immediately
    >> rather than after the erase process was about done.
    >>
    >> Is there some change I can make to the script to get the info in real
    >> time, or is it likely that NeroCmd.exe handles StdOut differently when
    >> its batch file is Shell Exec'ed than when run in a plain command line
    >> window, and I just have to live with it?
    >>
    >> Thanks for any help you can give me.
    >>
    >> -Paul Randall
    >
    > Since you already have a working single-line batch file, what might be the
    > purpose of creating a 15-line VB Script file to invoke it? If you must use
    > a VB Script, wouldn't it be more consistent to invoke NeroCmd.exe from
    > within the VB Script? It would certainly facilitate installation and
    > maintenance!
    Thanks for your response.

    My real script does Shell Exec indivual NeroCmds, reads the responses, and
    branches accordingly, to create one or more CDs whose source files come from
    2 GB flash cards. I wanted to post the simplest example that showed a
    significant difference between the real-time StdOut and what appears in a
    manually invoked command line box using the identical command. I'm hoping
    for help in getting info from StdOut in real time. This would help with
    providing progress info to the end user. Right now, they just get a blank
    black command line window; I think a 'This will take 61 seconds.' message at
    the start of the process would be more helpful, but only NeroCmd can give a
    reasonable estimate.

    -Paul Randall




      My System SpecsSystem Spec

  5. #4


    Tom Lavedas Guest

    Re: Problem with WSH Shell Exec StdOut

    On Jan 20, 1:11*pm, "Paul Randall" <paul...@xxxxxx> wrote:

    > "Pegasus (MVP)" <I....@xxxxxx> wrote in message
    >
    > news:%230$atZyeJHA.4528@xxxxxx
    >
    >
    >
    >
    >
    >
    >
    >
    >

    > > "Paul Randall" <paul...@xxxxxx> wrote in message
    > >news:O9DbWTyeJHA.4180@xxxxxx

    > >> I'm trying to Use WSH Shell Exec to run a 'command line' program and
    > >> catch its StdOut stream in real time. *I'm using Nero's NeroCmd.exe to
    > >> read, write, erase, and get info about a CD-RW in drive F:. *I'm running
    > >> WXP Pro SP2. *NeroCmd.exe is a command line utility included with or
    > >> usable with most versions of Nero in the past 5 or more years, including
    > >> the free versions included with many CD/DVD writers, I think.
    >

    > >> If I create and run a .bat file with the following on a single line:
    > >> C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    > >> 7\Core\NeroCmd.exe" --erase -- drivename f
    >

    > >> then almost immediately I get a command window displaying the following:
    > >> C:\Program Files\Windows Resource Kits\Tools>%comspec% /c "C:\Pr\Nero
    > >> 7\Core\NeroCmd.exe" --erase --drivename f
    > >> Erasing disc. This will take 61 seconds.
    >

    > >> and after about a minute an "OK." message appears and the command window
    > >> closes.
    >

    > >> The batch file runs differently if Shell Exec'ed.
    > >> Here is the script I'm currently using:
    > >> '-------------
    > >> Dim WshShell, oExec, input
    > >> Set WshShell = CreateObject("WScript.Shell")
    > >> Set oExec * *= WshShell.Exec("test2b.bat")
    >

    > >> Do While True
    > >> input = "At End Of Stream!"
    > >> Do while Not oExec.StdOut.AtEndOfStream
    > >> *input = Replace(input, "At End Of Stream!", "")
    > >> *input = input & oExec.StdOut.Read(1)
    > >> *'Display each line as it is received.
    > >> *If InStr(input, vbcrlf) <> 0 Then Exit Do
    > >> *WScript.Sleep 0
    > >> Loop
    > >> MsgBox "*" & input & "*"
    > >> WScript.Sleep 10
    > >> Loop
    > >> '-------------
    >

    > >> Sorry about the endless loop. *You have to abort the script by ending the
    > >> wscript.exe in windows task manager.
    >

    > >> If I use the VBScript above to use the shell object's exec method to run
    > >> the script, and to read and display the exec method's StdOut stream in
    > >> real time, I immediately get the following:
    >

    > >> 1: a message box with two asterisks indicating a vbCrLf was received.
    >

    > >> 2: a message box containing the command:
    > >> *C:\Documents and Settings\Paul\My Documents\vbScript\Nero Command
    > >> Line>C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    > >> 7\Core\NeroCmd.exe" --erase --drivename f **
    >

    > >> 3. after about a minute, I get two more message boxes:
    >

    > >> *Erasing disc. This will take 61 seconds.*
    >

    > >> and
    >

    > >> *Ok.*
    >

    > >> and an infinite number of *At End Of Stream!* messages.
    >

    > >> To me, this indicates that I am not getting StdOut in real time; the
    > >> 'this will take 61 seconds' should have occurred almost immediately
    > >> rather than after the erase process was about done.
    >

    > >> Is there some change I can make to the script to get the info in real
    > >> time, or is it likely that NeroCmd.exe handles StdOut differently when
    > >> its batch file is Shell Exec'ed than when run in a plain command line
    > >> window, and I just have to live with it?
    >

    > >> Thanks for any help you can give me.
    >

    > >> -Paul Randall
    >

    > > Since you already have a working single-line batch file, what might be the
    > > purpose of creating a 15-line VB Script file to invoke it? If you must use
    > > a VB Script, wouldn't it be more consistent to invoke NeroCmd.exe from
    > > within the VB Script? It would certainly facilitate installation and
    > > maintenance!
    >
    > Thanks for your response.
    >
    > My real script does Shell Exec indivual NeroCmds, reads the responses, and
    > branches accordingly, to create one or more CDs whose source files come from
    > 2 GB flash cards. *I wanted to post the simplest example that showed a
    > significant difference between the real-time StdOut and what appears in a
    > manually invoked command line box using the identical command. *I'm hoping
    > for help in getting info from StdOut in real time. *This would help with
    > providing progress info to the end user. *Right now, they just get a *blank
    > black command line window; I think a 'This will take 61 seconds.' messageat
    > the start of the process would be more helpful, but only NeroCmd can givea
    > reasonable estimate.
    >
    > -Paul Randall
    Redirect the output into a text file to prove that there is in fact a
    CR LF combination after the

    Erasing disc. This will take 61 seconds.

    line of text. My guess is that its LF CR or something else.

    Also, why not change this line ...

    Do While True

    to

    Do While oExec.Status = 0

    I'd also consider reading the text into a character variable which is
    displayed after each cycle through the inner Do loop, something like
    this ...

    set oCON = createobject("scripting.filesystemobject").open("con",8)

    Do While True
    input = "At End Of Stream!"
    Do while Not oExec.StdOut.AtEndOfStream
    input = Replace(input, "At End Of Stream!", "") ' why not just "" ?
    c = oExec.StdOut.Read(1)
    oCON.Write c
    'input = input & c
    'Display each line as it is received.
    If ASC(c) = 10 or ASC(c) = 13 Then Exit Do
    WScript.Sleep 10 ' was this a typo?
    Loop
    'MsgBox "*" & input & "*"
    WScript.Sleep 10
    Loop

    Run this from the command prompt with CSCRIPT.exe to test.

    Tom Lavedas
    ***********
    http://there.is.no.more/tglbatch/

      My System SpecsSystem Spec

  6. #5


    Pegasus \(MVP\) Guest

    Re: Problem with WSH Shell Exec StdOut


    "Paul Randall" <paulr90@xxxxxx> wrote in message
    news:OsENNqyeJHA.4180@xxxxxx

    >
    > "Pegasus (MVP)" <I.can@xxxxxx> wrote in message
    > news:%230$atZyeJHA.4528@xxxxxx

    >>
    >> "Paul Randall" <paulr90@xxxxxx> wrote in message
    >> news:O9DbWTyeJHA.4180@xxxxxx

    >>> I'm trying to Use WSH Shell Exec to run a 'command line' program and
    >>> catch its StdOut stream in real time. I'm using Nero's NeroCmd.exe to
    >>> read, write, erase, and get info about a CD-RW in drive F:. I'm running
    >>> WXP Pro SP2. NeroCmd.exe is a command line utility included with or
    >>> usable with most versions of Nero in the past 5 or more years, including
    >>> the free versions included with many CD/DVD writers, I think.
    >>>
    >>> If I create and run a .bat file with the following on a single line:
    >>> C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    >>> 7\Core\NeroCmd.exe" --erase -- drivename f
    >>>
    >>> then almost immediately I get a command window displaying the following:
    >>> C:\Program Files\Windows Resource Kits\Tools>%comspec% /c "C:\Pr\Nero
    >>> 7\Core\NeroCmd.exe" --erase --drivename f
    >>> Erasing disc. This will take 61 seconds.
    >>>
    >>> and after about a minute an "OK." message appears and the command window
    >>> closes.
    >>>
    >>> The batch file runs differently if Shell Exec'ed.
    >>> Here is the script I'm currently using:
    >>> '-------------
    >>> Dim WshShell, oExec, input
    >>> Set WshShell = CreateObject("WScript.Shell")
    >>> Set oExec = WshShell.Exec("test2b.bat")
    >>>
    >>> Do While True
    >>> input = "At End Of Stream!"
    >>> Do while Not oExec.StdOut.AtEndOfStream
    >>> input = Replace(input, "At End Of Stream!", "")
    >>> input = input & oExec.StdOut.Read(1)
    >>> 'Display each line as it is received.
    >>> If InStr(input, vbcrlf) <> 0 Then Exit Do
    >>> WScript.Sleep 0
    >>> Loop
    >>> MsgBox "*" & input & "*"
    >>> WScript.Sleep 10
    >>> Loop
    >>> '-------------
    >>>
    >>> Sorry about the endless loop. You have to abort the script by ending
    >>> the wscript.exe in windows task manager.
    >>>
    >>> If I use the VBScript above to use the shell object's exec method to run
    >>> the script, and to read and display the exec method's StdOut stream in
    >>> real time, I immediately get the following:
    >>>
    >>> 1: a message box with two asterisks indicating a vbCrLf was received.
    >>>
    >>> 2: a message box containing the command:
    >>> *C:\Documents and Settings\Paul\My Documents\vbScript\Nero Command
    >>> Line>C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    >>> 7\Core\NeroCmd.exe" --erase --drivename f *
    >>>
    >>> 3. after about a minute, I get two more message boxes:
    >>>
    >>> *Erasing disc. This will take 61 seconds.*
    >>>
    >>> and
    >>>
    >>> *Ok.*
    >>>
    >>> and an infinite number of *At End Of Stream!* messages.
    >>>
    >>> To me, this indicates that I am not getting StdOut in real time; the
    >>> 'this will take 61 seconds' should have occurred almost immediately
    >>> rather than after the erase process was about done.
    >>>
    >>> Is there some change I can make to the script to get the info in real
    >>> time, or is it likely that NeroCmd.exe handles StdOut differently when
    >>> its batch file is Shell Exec'ed than when run in a plain command line
    >>> window, and I just have to live with it?
    >>>
    >>> Thanks for any help you can give me.
    >>>
    >>> -Paul Randall
    >>
    >> Since you already have a working single-line batch file, what might be
    >> the purpose of creating a 15-line VB Script file to invoke it? If you
    >> must use a VB Script, wouldn't it be more consistent to invoke
    >> NeroCmd.exe from within the VB Script? It would certainly facilitate
    >> installation and maintenance!
    >
    > Thanks for your response.
    >
    > My real script does Shell Exec indivual NeroCmds, reads the responses, and
    > branches accordingly, to create one or more CDs whose source files come
    > from 2 GB flash cards. I wanted to post the simplest example that showed
    > a significant difference between the real-time StdOut and what appears in
    > a manually invoked command line box using the identical command. I'm
    > hoping for help in getting info from StdOut in real time. This would help
    > with providing progress info to the end user. Right now, they just get a
    > blank black command line window; I think a 'This will take 61 seconds.'
    > message at the start of the process would be more helpful, but only
    > NeroCmd can give a reasonable estimate.
    >
    > -Paul Randall
    AFAIK you can't display real time output using the exec method because your
    script will not move beyond the line
    Set oExec = WshShell.Exec("test2b.bat")
    until test2b.bat has finshed its job. When erasing a CD, this will take some
    60 seconds.



      My System SpecsSystem Spec

  7. #6


    Paul Randall Guest

    Re: Problem with WSH Shell Exec StdOut


    "Pegasus (MVP)" <I.can@xxxxxx> wrote in message
    news:ek$sphzeJHA.4124@xxxxxx

    >
    > "Paul Randall" <paulr90@xxxxxx> wrote in message
    > news:OsENNqyeJHA.4180@xxxxxx

    >>
    >> "Pegasus (MVP)" <I.can@xxxxxx> wrote in message
    >> news:%230$atZyeJHA.4528@xxxxxx

    >>>
    >>> "Paul Randall" <paulr90@xxxxxx> wrote in message
    >>> news:O9DbWTyeJHA.4180@xxxxxx
    >>>> I'm trying to Use WSH Shell Exec to run a 'command line' program and
    >>>> catch its StdOut stream in real time. I'm using Nero's NeroCmd.exe to
    >>>> read, write, erase, and get info about a CD-RW in drive F:. I'm
    >>>> running WXP Pro SP2. NeroCmd.exe is a command line utility included
    >>>> with or usable with most versions of Nero in the past 5 or more years,
    >>>> including the free versions included with many CD/DVD writers, I think.
    >>>>
    >>>> If I create and run a .bat file with the following on a single line:
    >>>> C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    >>>> 7\Core\NeroCmd.exe" --erase -- drivename f
    >>>>
    >>>> then almost immediately I get a command window displaying the
    >>>> following:
    >>>> C:\Program Files\Windows Resource Kits\Tools>%comspec% /c "C:\Pr\Nero
    >>>> 7\Core\NeroCmd.exe" --erase --drivename f
    >>>> Erasing disc. This will take 61 seconds.
    >>>>
    >>>> and after about a minute an "OK." message appears and the command
    >>>> window closes.
    >>>>
    >>>> The batch file runs differently if Shell Exec'ed.
    >>>> Here is the script I'm currently using:
    >>>> '-------------
    >>>> Dim WshShell, oExec, input
    >>>> Set WshShell = CreateObject("WScript.Shell")
    >>>> Set oExec = WshShell.Exec("test2b.bat")
    >>>>
    >>>> Do While True
    >>>> input = "At End Of Stream!"
    >>>> Do while Not oExec.StdOut.AtEndOfStream
    >>>> input = Replace(input, "At End Of Stream!", "")
    >>>> input = input & oExec.StdOut.Read(1)
    >>>> 'Display each line as it is received.
    >>>> If InStr(input, vbcrlf) <> 0 Then Exit Do
    >>>> WScript.Sleep 0
    >>>> Loop
    >>>> MsgBox "*" & input & "*"
    >>>> WScript.Sleep 10
    >>>> Loop
    >>>> '-------------
    >>>>
    >>>> Sorry about the endless loop. You have to abort the script by ending
    >>>> the wscript.exe in windows task manager.
    >>>>
    >>>> If I use the VBScript above to use the shell object's exec method to
    >>>> run the script, and to read and display the exec method's StdOut stream
    >>>> in real time, I immediately get the following:
    >>>>
    >>>> 1: a message box with two asterisks indicating a vbCrLf was received.
    >>>>
    >>>> 2: a message box containing the command:
    >>>> *C:\Documents and Settings\Paul\My Documents\vbScript\Nero Command
    >>>> Line>C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    >>>> 7\Core\NeroCmd.exe" --erase --drivename f *
    >>>>
    >>>> 3. after about a minute, I get two more message boxes:
    >>>>
    >>>> *Erasing disc. This will take 61 seconds.*
    >>>>
    >>>> and
    >>>>
    >>>> *Ok.*
    >>>>
    >>>> and an infinite number of *At End Of Stream!* messages.
    >>>>
    >>>> To me, this indicates that I am not getting StdOut in real time; the
    >>>> 'this will take 61 seconds' should have occurred almost immediately
    >>>> rather than after the erase process was about done.
    >>>>
    >>>> Is there some change I can make to the script to get the info in real
    >>>> time, or is it likely that NeroCmd.exe handles StdOut differently when
    >>>> its batch file is Shell Exec'ed than when run in a plain command line
    >>>> window, and I just have to live with it?
    >>>>
    >>>> Thanks for any help you can give me.
    >>>>
    >>>> -Paul Randall
    >>>
    >>> Since you already have a working single-line batch file, what might be
    >>> the purpose of creating a 15-line VB Script file to invoke it? If you
    >>> must use a VB Script, wouldn't it be more consistent to invoke
    >>> NeroCmd.exe from within the VB Script? It would certainly facilitate
    >>> installation and maintenance!
    >>
    >> Thanks for your response.
    >>
    >> My real script does Shell Exec indivual NeroCmds, reads the responses,
    >> and branches accordingly, to create one or more CDs whose source files
    >> come from 2 GB flash cards. I wanted to post the simplest example that
    >> showed a significant difference between the real-time StdOut and what
    >> appears in a manually invoked command line box using the identical
    >> command. I'm hoping for help in getting info from StdOut in real time.
    >> This would help with providing progress info to the end user. Right now,
    >> they just get a blank black command line window; I think a 'This will
    >> take 61 seconds.' message at the start of the process would be more
    >> helpful, but only NeroCmd can give a reasonable estimate.
    >>
    >> -Paul Randall
    >
    > AFAIK you can't display real time output using the exec method because
    > your script will not move beyond the line
    > Set oExec = WshShell.Exec("test2b.bat")
    > until test2b.bat has finshed its job. When erasing a CD, this will take
    > some 60 seconds.
    Thanks for your response. I appreciate your interest in this.

    I think I disproved the theory that 'your script will not move beyond the
    line ...', when I stated:

    >>>> ... I immediately get the following:
    >>>>
    >>>> 1: a message box with two asterisks indicating a vbCrLf was received.
    >>>>
    >>>> 2: a message box containing the command:
    >>>> *C:\Documents and Settings\Paul\My Documents\vbScript\Nero Command
    >>>> Line>C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    >>>> 7\Core\NeroCmd.exe" --erase --drivename f *
    >>>>
    >>>> 3. after about a minute, I get two more message boxes:
    >>>>
    >>>> *Erasing disc. This will take 61 seconds.*
    The echoing of the batch file's command indicates that the StdOut stream is
    making that much immediately available. What I don't understand is why none
    of NeroCmd.exe's output to StdOut is available until the process ends, if
    the batch file or the complete NeroCmd statement is started through WSH
    Shell exec. It is all displayed in real time when the batch file or NeroCmd
    statement is started manually.

    I wish I knew of a native WXP command line utility example that would take a
    significant period over which to execute but which only sends a line of
    output occasionally, so we could have a VBScript display each line from
    StdOut as it occurs. Perhaps you know of something?

    -Paul Randall



      My System SpecsSystem Spec

  8. #7


    Paul Randall Guest

    Re: Problem with WSH Shell Exec StdOut


    "Tom Lavedas" <tglbatch@xxxxxx> wrote in message
    news:688e9959-bc5c-4c7d-a0b5-2f76f3b903a6@xxxxxx
    On Jan 20, 1:11 pm, "Paul Randall" <paul...@xxxxxx> wrote:

    > "Pegasus (MVP)" <I....@xxxxxx> wrote in message
    >
    > news:%230$atZyeJHA.4528@xxxxxx
    >
    >
    >
    >
    >
    >
    >
    >
    >

    > > "Paul Randall" <paul...@xxxxxx> wrote in message
    > >news:O9DbWTyeJHA.4180@xxxxxx

    > >> I'm trying to Use WSH Shell Exec to run a 'command line' program and
    > >> catch its StdOut stream in real time. I'm using Nero's NeroCmd.exe to
    > >> read, write, erase, and get info about a CD-RW in drive F:. I'm running
    > >> WXP Pro SP2. NeroCmd.exe is a command line utility included with or
    > >> usable with most versions of Nero in the past 5 or more years,
    > >> including
    > >> the free versions included with many CD/DVD writers, I think.
    >

    > >> If I create and run a .bat file with the following on a single line:
    > >> C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    > >> 7\Core\NeroCmd.exe" --erase -- drivename f
    >

    > >> then almost immediately I get a command window displaying the
    > >> following:
    > >> C:\Program Files\Windows Resource Kits\Tools>%comspec% /c "C:\Pr\Nero
    > >> 7\Core\NeroCmd.exe" --erase --drivename f
    > >> Erasing disc. This will take 61 seconds.
    >

    > >> and after about a minute an "OK." message appears and the command
    > >> window
    > >> closes.
    >

    > >> The batch file runs differently if Shell Exec'ed.
    > >> Here is the script I'm currently using:
    > >> '-------------
    > >> Dim WshShell, oExec, input
    > >> Set WshShell = CreateObject("WScript.Shell")
    > >> Set oExec = WshShell.Exec("test2b.bat")
    >

    > >> Do While True
    > >> input = "At End Of Stream!"
    > >> Do while Not oExec.StdOut.AtEndOfStream
    > >> input = Replace(input, "At End Of Stream!", "")
    > >> input = input & oExec.StdOut.Read(1)
    > >> 'Display each line as it is received.
    > >> If InStr(input, vbcrlf) <> 0 Then Exit Do
    > >> WScript.Sleep 0
    > >> Loop
    > >> MsgBox "*" & input & "*"
    > >> WScript.Sleep 10
    > >> Loop
    > >> '-------------
    >

    > >> Sorry about the endless loop. You have to abort the script by ending
    > >> the
    > >> wscript.exe in windows task manager.
    >

    > >> If I use the VBScript above to use the shell object's exec method to
    > >> run
    > >> the script, and to read and display the exec method's StdOut stream in
    > >> real time, I immediately get the following:
    >

    > >> 1: a message box with two asterisks indicating a vbCrLf was received.
    >

    > >> 2: a message box containing the command:
    > >> *C:\Documents and Settings\Paul\My Documents\vbScript\Nero Command
    > >> Line>C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    > >> 7\Core\NeroCmd.exe" --erase --drivename f *
    >

    > >> 3. after about a minute, I get two more message boxes:
    >

    > >> *Erasing disc. This will take 61 seconds.*
    >

    > >> and
    >

    > >> *Ok.*
    >

    > >> and an infinite number of *At End Of Stream!* messages.
    >

    > >> To me, this indicates that I am not getting StdOut in real time; the
    > >> 'this will take 61 seconds' should have occurred almost immediately
    > >> rather than after the erase process was about done.
    >

    > >> Is there some change I can make to the script to get the info in real
    > >> time, or is it likely that NeroCmd.exe handles StdOut differently when
    > >> its batch file is Shell Exec'ed than when run in a plain command line
    > >> window, and I just have to live with it?
    >

    > >> Thanks for any help you can give me.
    >

    > >> -Paul Randall
    >

    > > Since you already have a working single-line batch file, what might be
    > > the
    > > purpose of creating a 15-line VB Script file to invoke it? If you must
    > > use
    > > a VB Script, wouldn't it be more consistent to invoke NeroCmd.exe from
    > > within the VB Script? It would certainly facilitate installation and
    > > maintenance!
    >
    > Thanks for your response.
    >
    > My real script does Shell Exec indivual NeroCmds, reads the responses, and
    > branches accordingly, to create one or more CDs whose source files come
    > from
    > 2 GB flash cards. I wanted to post the simplest example that showed a
    > significant difference between the real-time StdOut and what appears in a
    > manually invoked command line box using the identical command. I'm hoping
    > for help in getting info from StdOut in real time. This would help with
    > providing progress info to the end user. Right now, they just get a blank
    > black command line window; I think a 'This will take 61 seconds.' message
    > at
    > the start of the process would be more helpful, but only NeroCmd can give
    > a
    > reasonable estimate.
    >
    > -Paul Randall
    Redirect the output into a text file to prove that there is in fact a
    CR LF combination after the

    Erasing disc. This will take 61 seconds.

    line of text. My guess is that its LF CR or something else.

    Also, why not change this line ...

    Do While True

    to

    Do While oExec.Status = 0

    I'd also consider reading the text into a character variable which is
    displayed after each cycle through the inner Do loop, something like
    this ...

    set oCON = createobject("scripting.filesystemobject").open("con",8)

    Do While True
    input = "At End Of Stream!"
    Do while Not oExec.StdOut.AtEndOfStream
    input = Replace(input, "At End Of Stream!", "") ' why not just "" ?
    c = oExec.StdOut.Read(1)
    oCON.Write c
    'input = input & c
    'Display each line as it is received.
    If ASC(c) = 10 or ASC(c) = 13 Then Exit Do
    WScript.Sleep 10 ' was this a typo?
    Loop
    'MsgBox "*" & input & "*"
    WScript.Sleep 10
    Loop

    Run this from the command prompt with CSCRIPT.exe to test.

    Tom Lavedas
    ***********
    http://there.is.no.more/tglbatch/

    ------------------------------------------------------------
    Thanks, Tom
    I will try your ideas and get back with my results.
    My silly 'Do While True' is just a cut and paste from one of the VBScript
    examples in the scripting help file.

    -Paul Randall



      My System SpecsSystem Spec

  9. #8


    Tom Lavedas Guest

    Re: Problem with WSH Shell Exec StdOut

    On Jan 20, 3:30*pm, "Paul Randall" <paul...@xxxxxx> wrote:

    > "Pegasus (MVP)" <I....@xxxxxx> wrote in message
    >
    > news:ek$sphzeJHA.4124@xxxxxx
    >
    >
    >
    >
    >

    > > "Paul Randall" <paul...@xxxxxx> wrote in message
    > >news:OsENNqyeJHA.4180@xxxxxx
    >

    > >> "Pegasus (MVP)" <I....@xxxxxx> wrote in message
    > >>news:%230$atZyeJHA.4528@xxxxxx
    >

    > >>> "Paul Randall" <paul...@xxxxxx> wrote in message
    > >>>news:O9DbWTyeJHA.4180@xxxxxx
    > >>>> I'm trying to Use WSH Shell Exec to run a 'command line' program and
    > >>>> catch its StdOut stream in real time. *I'm using Nero's NeroCmd.exe to
    > >>>> read, write, erase, and get info about a CD-RW in drive F:. *I'm
    > >>>> running WXP Pro SP2. *NeroCmd.exe is a command line utility included
    > >>>> with or usable with most versions of Nero in the past 5 or more years,
    > >>>> including the free versions included with many CD/DVD writers, I think.
    >

    > >>>> If I create and run a .bat file with the following on a single line:
    > >>>> C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    > >>>> 7\Core\NeroCmd.exe" --erase -- drivename f
    >

    > >>>> then almost immediately I get a command window displaying the
    > >>>> following:
    > >>>> C:\Program Files\Windows Resource Kits\Tools>%comspec% /c "C:\Pr\Nero
    > >>>> 7\Core\NeroCmd.exe" --erase --drivename f
    > >>>> Erasing disc. This will take 61 seconds.
    >

    > >>>> and after about a minute an "OK." message appears and the command
    > >>>> window closes.
    >

    > >>>> The batch file runs differently if Shell Exec'ed.
    > >>>> Here is the script I'm currently using:
    > >>>> '-------------
    > >>>> Dim WshShell, oExec, input
    > >>>> Set WshShell = CreateObject("WScript.Shell")
    > >>>> Set oExec * *= WshShell.Exec("test2b.bat")
    >

    > >>>> Do While True
    > >>>> input = "At End Of Stream!"
    > >>>> Do while Not oExec.StdOut.AtEndOfStream
    > >>>> *input = Replace(input, "At End Of Stream!", "")
    > >>>> *input = input & oExec.StdOut.Read(1)
    > >>>> *'Display each line as it is received.
    > >>>> *If InStr(input, vbcrlf) <> 0 Then Exit Do
    > >>>> *WScript.Sleep 0
    > >>>> Loop
    > >>>> MsgBox "*" & input & "*"
    > >>>> WScript.Sleep 10
    > >>>> Loop
    > >>>> '-------------
    >

    > >>>> Sorry about the endless loop. *You have to abort the script by ending
    > >>>> the wscript.exe in windows task manager.
    >

    > >>>> If I use the VBScript above to use the shell object's exec method to
    > >>>> run the script, and to read and display the exec method's StdOut stream
    > >>>> in real time, I immediately get the following:
    >

    > >>>> 1: a message box with two asterisks indicating a vbCrLf was received..
    >

    > >>>> 2: a message box containing the command:
    > >>>> *C:\Documents and Settings\Paul\My Documents\vbScript\Nero Command
    > >>>> Line>C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    > >>>> 7\Core\NeroCmd.exe" --erase --drivename f **
    >

    > >>>> 3. after about a minute, I get two more message boxes:
    >

    > >>>> *Erasing disc. This will take 61 seconds.*
    >

    > >>>> and
    >

    > >>>> *Ok.*
    >

    > >>>> and an infinite number of *At End Of Stream!* messages.
    >

    > >>>> To me, this indicates that I am not getting StdOut in real time; the
    > >>>> 'this will take 61 seconds' should have occurred almost immediately
    > >>>> rather than after the erase process was about done.
    >

    > >>>> Is there some change I can make to the script to get the info in real
    > >>>> time, or is it likely that NeroCmd.exe handles StdOut differently when
    > >>>> its batch file is Shell Exec'ed than when run in a plain command line
    > >>>> window, and I just have to live with it?
    >

    > >>>> Thanks for any help you can give me.
    >

    > >>>> -Paul Randall
    >

    > >>> Since you already have a working single-line batch file, what might be
    > >>> the purpose of creating a 15-line VB Script file to invoke it? If you
    > >>> must use a VB Script, wouldn't it be more consistent to invoke
    > >>> NeroCmd.exe from within the VB Script? It would certainly facilitate
    > >>> installation and maintenance!
    >

    > >> Thanks for your response.
    >

    > >> My real script does Shell Exec indivual NeroCmds, reads the responses,
    > >> and branches accordingly, to create one or more CDs whose source files
    > >> come from 2 GB flash cards. *I wanted to post the simplest example that
    > >> showed a significant difference between the real-time StdOut and what
    > >> appears in a manually invoked command line box using the identical
    > >> command. *I'm hoping for help in getting info from StdOut in real time.
    > >> This would help with providing progress info to the end user. *Rightnow,
    > >> they just get a blank black command line window; I think a 'This will
    > >> take 61 seconds.' message at the start of the process would be more
    > >> helpful, but only NeroCmd can give a reasonable estimate.
    >

    > >> -Paul Randall
    >

    > > AFAIK you can't display real time output using the exec method because
    > > your script will not move beyond the line
    > > Set oExec = WshShell.Exec("test2b.bat")
    > > until test2b.bat has finshed its job. When erasing a CD, this will take
    > > some 60 seconds.
    >
    > Thanks for your response. *I appreciate your interest in this.
    >
    > I think I disproved the theory that 'your script will not move beyond the
    > line ...', when I stated:
    >

    > >>>> *... *I immediately get the following:
    >

    > >>>> 1: a message box with two asterisks indicating a vbCrLf was received..
    >

    > >>>> 2: a message box containing the command:
    > >>>> *C:\Documents and Settings\Paul\My Documents\vbScript\Nero Command
    > >>>> Line>C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\Nero\Nero
    > >>>> 7\Core\NeroCmd.exe" --erase --drivename f **
    >

    > >>>> 3. after about a minute, I get two more message boxes:
    >

    > >>>> *Erasing disc. This will take 61 seconds.*
    >
    > The echoing of the batch file's command indicates that the StdOut stream is
    > making that much immediately available. *What I don't understand is whynone
    > of NeroCmd.exe's output to StdOut is available until the process ends, if
    > the batch file or the complete NeroCmd statement is started through WSH
    > Shell exec. *It is all displayed in real time when the batch file or NeroCmd
    > statement is started manually.
    >
    > I wish I knew of a native WXP command line utility example that would take a
    > significant period over which to execute but which only sends a line of
    > output occasionally, so we could have a VBScript display each line from
    > StdOut as it occurs. *Perhaps you know of something?
    >
    > -Paul Randall
    Pegasus' statement that 'your script will not move beyond the
    line ...' is, indeed, incorrect. However, there are many other
    processes that will block progress. One of them is a Readline or
    ReadAll, which you have avoided. I have encountered many situations
    where I just could not get 'real time' data out of the Exec method, no
    matter how hard I tried. I usually abandon the project, with the
    vague hope of investigating further at a later date (which almost
    never comes).

    One other possibility is that the application is posting its output,
    or some of it, to the StdErr rather to StdOut. But, I don't think
    your symptoms suggest that. I don't have Nero on this machine, but do
    have it on my machine at home. I'll see if I can get a few minutes
    tonight to play with this.

    In general, I try to avoid Exec, except when I want to execute
    something in the console session running the script. Otherwise, I
    generally stick to the Run method.

    Tom Lavedas
    ***********
    http://there.is.no.more/tglbatch/

      My System SpecsSystem Spec

  10. #9


    ekkehard.horner Guest

    Re: Problem with WSH Shell Exec StdOut

    Paul Randall schrieb:
    [...]

    > I wish I knew of a native WXP command line utility example that would take a
    > significant period over which to execute but which only sends a line of
    > output occasionally, so we could have a VBScript display each line from
    > StdOut as it occurs. Perhaps you know of something?
    [...]
    I used:

    -- sleeper.vbs
    Option Explicit
    Dim nCount : nCount = 5
    Dim nSleep : nSleep = 500
    If 0 < WScript.Arguments.Count Then nCount = CInt( WScript.Arguments( 0 ) )
    If 1 < WScript.Arguments.Count Then nSleep = CInt( WScript.Arguments( 1 ) )
    Do Until 1 > nCount
    WScript.Echo "Sleeper", nCount, Now
    nCount = nCount - 1
    WScript.Sleep nSleep
    Loop

    -- sleeper.bat
    @cho off
    echo sleeper.bat start
    cscript sleeper.vbs %1 %2
    echo sleeper.bat end

    -- testsleeper.vbs
    Option Explicit

    Const WshRunning = 0
    Const WshFinished = 1

    Dim oWSH : Set oWSH = CreateObject( "WScript.Shell" )
    Dim sCmd : sCmd = "cscript sleeper.vbs"
    sCmd = "sleeper.bat 5 1000"
    Dim oExec : Set oExec = oWSH.Exec( sCmd )
    Do Until oExec.Status = WshFinished
    WScript.Echo "testSleeper", Now, oExec.StdOut.ReadLine()
    Loop

    to get

    testSleeper 20.01.2009 22:32:44 Sleeper 5 20.01.2009 22:32:44
    testSleeper 20.01.2009 22:32:44 Sleeper 4 20.01.2009 22:32:45
    testSleeper 20.01.2009 22:32:45 Sleeper 3 20.01.2009 22:32:45
    testSleeper 20.01.2009 22:32:45 Sleeper 2 20.01.2009 22:32:46
    testSleeper 20.01.2009 22:32:46 Sleeper 1 20.01.2009 22:32:46
    testSleeper 20.01.2009 22:32:46
    testSleeper 20.01.2009 22:32:47
    testSleeper 20.01.2009 22:32:47

    resp.

    cscript testsleeper.vbs
    testSleeper 20.01.2009 22:30:48
    testSleeper 20.01.2009 22:30:48 C:\wis\_vbs\0506\dev\forum
    testSleeper 20.01.2009 22:30:48 echo sleeper.bat start
    testSleeper 20.01.2009 22:30:48 sleeper.bat start
    testSleeper 20.01.2009 22:30:48
    testSleeper 20.01.2009 22:30:48 C:\wis\_vbs\0506\dev\forum
    testSleeper 20.01.2009 22:30:48 cscript sleeper.vbs 5 1000
    testSleeper 20.01.2009 22:30:48 Sleeper 5 20.01.2009 22:30:48
    testSleeper 20.01.2009 22:30:48 Sleeper 4 20.01.2009 22:30:49
    testSleeper 20.01.2009 22:30:49 Sleeper 3 20.01.2009 22:30:50
    testSleeper 20.01.2009 22:30:50 Sleeper 2 20.01.2009 22:30:51
    testSleeper 20.01.2009 22:30:51 Sleeper 1 20.01.2009 22:30:52
    testSleeper 20.01.2009 22:30:52
    testSleeper 20.01.2009 22:30:53 C:\wis\_vbs\0506\dev\forum
    testSleeper 20.01.2009 22:30:53 echo sleeper.bat end
    testSleeper 20.01.2009 22:30:53 sleeper.bat end
    testSleeper 20.01.2009 22:30:53
    testSleeper 20.01.2009 22:30:53
    testSleeper 20.01.2009 22:30:53

    I *think* that shows that Exec.StdOut.Read* gets the data as soon as
    possible (even if you use an intermediate .bat file).

      My System SpecsSystem Spec

  11. #10


    Paul Randall Guest

    Re: Problem with WSH Shell Exec StdOut


    "ekkehard.horner" <ekkehard.horner@xxxxxx> wrote in message
    news:49764409$0$30239$9b4e6d93@xxxxxx-online.net...

    > Paul Randall schrieb:
    > [...]

    >> I wish I knew of a native WXP command line utility example that would
    >> take a significant period over which to execute but which only sends a
    >> line of output occasionally, so we could have a VBScript display each
    >> line from StdOut as it occurs. Perhaps you know of something?
    > [...]
    > I used:
    >
    > -- sleeper.vbs
    > Option Explicit
    > Dim nCount : nCount = 5
    > Dim nSleep : nSleep = 500
    > If 0 < WScript.Arguments.Count Then nCount = CInt(
    > WScript.Arguments( 0 ) )
    > If 1 < WScript.Arguments.Count Then nSleep = CInt(
    > WScript.Arguments( 1 ) )
    > Do Until 1 > nCount
    > WScript.Echo "Sleeper", nCount, Now
    > nCount = nCount - 1
    > WScript.Sleep nSleep
    > Loop
    >
    > -- sleeper.bat
    > @cho off
    > echo sleeper.bat start
    > cscript sleeper.vbs %1 %2
    > echo sleeper.bat end
    >
    > -- testsleeper.vbs
    > Option Explicit
    >
    > Const WshRunning = 0
    > Const WshFinished = 1
    >
    > Dim oWSH : Set oWSH = CreateObject( "WScript.Shell" )
    > Dim sCmd : sCmd = "cscript sleeper.vbs"
    > sCmd = "sleeper.bat 5 1000"
    > Dim oExec : Set oExec = oWSH.Exec( sCmd )
    > Do Until oExec.Status = WshFinished
    > WScript.Echo "testSleeper", Now, oExec.StdOut.ReadLine()
    > Loop
    >
    > to get
    >
    > testSleeper 20.01.2009 22:32:44 Sleeper 5 20.01.2009 22:32:44
    > testSleeper 20.01.2009 22:32:44 Sleeper 4 20.01.2009 22:32:45
    > testSleeper 20.01.2009 22:32:45 Sleeper 3 20.01.2009 22:32:45
    > testSleeper 20.01.2009 22:32:45 Sleeper 2 20.01.2009 22:32:46
    > testSleeper 20.01.2009 22:32:46 Sleeper 1 20.01.2009 22:32:46
    > testSleeper 20.01.2009 22:32:46
    > testSleeper 20.01.2009 22:32:47
    > testSleeper 20.01.2009 22:32:47
    >
    > resp.
    >
    > cscript testsleeper.vbs
    > testSleeper 20.01.2009 22:30:48
    > testSleeper 20.01.2009 22:30:48 C:\wis\_vbs\0506\dev\forum
    > testSleeper 20.01.2009 22:30:48 echo sleeper.bat start
    > testSleeper 20.01.2009 22:30:48 sleeper.bat start
    > testSleeper 20.01.2009 22:30:48
    > testSleeper 20.01.2009 22:30:48 C:\wis\_vbs\0506\dev\forum
    > testSleeper 20.01.2009 22:30:48 cscript sleeper.vbs 5 1000
    > testSleeper 20.01.2009 22:30:48 Sleeper 5 20.01.2009 22:30:48
    > testSleeper 20.01.2009 22:30:48 Sleeper 4 20.01.2009 22:30:49
    > testSleeper 20.01.2009 22:30:49 Sleeper 3 20.01.2009 22:30:50
    > testSleeper 20.01.2009 22:30:50 Sleeper 2 20.01.2009 22:30:51
    > testSleeper 20.01.2009 22:30:51 Sleeper 1 20.01.2009 22:30:52
    > testSleeper 20.01.2009 22:30:52
    > testSleeper 20.01.2009 22:30:53 C:\wis\_vbs\0506\dev\forum
    > testSleeper 20.01.2009 22:30:53 echo sleeper.bat end
    > testSleeper 20.01.2009 22:30:53 sleeper.bat end
    > testSleeper 20.01.2009 22:30:53
    > testSleeper 20.01.2009 22:30:53
    > testSleeper 20.01.2009 22:30:53
    >
    > I *think* that shows that Exec.StdOut.Read* gets the data as soon as
    > possible (even if you use an intermediate .bat file).
    Yes, I agree that is what it shows. Which implies that NeroCmd does send
    its output to StdOut properly when run manually but has a problem when run
    within Shell.Exec.

    Thanks you for this suite of scripts that demonstrates how nicely StdOut can
    work.

    -Paul Randall



      My System SpecsSystem Spec

Page 1 of 2 12 LastLast

Problem with WSH Shell Exec StdOut
Similar Threads
Thread Forum
Backup Exec OLE DB problem with SBS2k3 R2 premium SBS Server
Can parent shell monitor run/crash status of Child shell/exe ? PowerShell
redirect powershell stdout to objShell.Exec.Stdout.ReadAll()( PowerShell
Executing Power Shell Scripts from Windows Shell PowerShell
Shell extension - how do I disable the preview pane for my shell e Aero