| |
garfunkal
Posts: 25
Score: 0
Joined: 3/5/2008
Status: offline
|
hiya I have a peice of code that runs a bat file - it runs lovely using the run method - but i need to use stdout - so I altered it to exec. Initially i had problems which i assumed where to do with the stdout processing i added, so i commented it out - but still an issue. If i run in cscript the control passes almost immediatly back to the cmd line - if i run in wscript it opens up an empty command window but hangs - neither acually runs the bat! can anyone suggest where i am going wrong? i am using 5.6 so it isnt that exec isnt on the install! I know in Run i can look at the output - but i suppose in exec I cant do that. cheers for any help - code below (only the pertinent processing) andrew Dim fso, objshell Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("wscript.shell") 'Set objShell = WScript.CreateObject("WScript.Shell") Set objExecObject = objShell.Exec("D:\Infogix\Assure\usi-data\Scripts\AISMI_Infogix_RunCP_Utility_CA.bat") 'Do While Not objExecObject.StdOut.AtEndOfStream ' ' strResults = objExecObject.StdOut.ReadAll ' ' 'If InStr(1, strResults, "Control Point Return Code: 16", vbTextCompare) Then ' If InStr(1, strResults, "Control Point Return Code", vbTextCompare) >0 Then ' wscript.echo "Exit Code= 16 " & strResults ' end if 'loop wscript.quit
|
|