I made some changes to the script so that this utility could be called
through WshShell.Run instead, which worked. Can anyone explain why that
would be? Also, I read some past messages in this newsgroup regarding
problems using WshShell.Exec with programs that generate a lot of text to
StdErr. Could this be the problem?
Thanks,
Brian Baker
--
Microsoft MVP -- ASP / ASP.NET
Please post responses to the group
It certainly could be and probably is...
Here's the WshShell.Exec template code I use to ensure that all output is
captured and the Exec'd process doesn't block on a full stdout buffer...
sCmd = "some command string"
set shell = createobject("wscript.shell")
Set d = CreateObject("Scripting.Dictionary")
set wsx = shell.exec(sCmd)
set wsxOut = wsx.stdout
do: wscript.sleep 10
do until wsxOut.atendofstream
d(d.count) = wsxOut.readline
loop
loop until wsx.status <> 0 and wsxOut.atendofstream
arLines = d.items()
--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
Windows 2000 Scripting Guide
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp
Script Center
http://www.microsoft.com/technet/scriptcenter/default.asp
Download details: System Administration Scripting Guide Scripts
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=B4CB2678-DAFB-4E30-B2DA-B8814FE2DA5A
Hmm, after thinking about it a little more I believe I know what the
problem is... Previously, I was just waiting until WshScriptExec.Status
<> 0, and then doing a .StdErr.ReadAll. I guess I need to be pulling it
out of the buffer as it goes so that the buffer does not get full. I
think that is what is happening... the program is waiting for the buffer
to be emptied so that it can add additional text to the buffer.
Do you know where to find documentation about the max size of the buffers?
I tried looking for some documentation about the NT 4 command shell but I
couldn't locate it on MSDN.
You can search around on MSDN.
Character-Mode Applications
http://msdn.microsoft.com/library/en-us/dllproc/base/character_mode_applications.asp
is probably the best place to start.
Is there a reason you really need to know the max size? As long as you read
from the Exec'd process's StdOut as it executes, you shouldn't have a
problem.