Hey folks.

Thanks for all the help prior.
I am now trying to collect the output information from a cmdline tool.
pslist

I would like to run pslist and put its contents into a variable that I can
later write to a file.
Can someone help me with this

Thanks

Re: cmd tool output to variable by Marty

Marty
Wed Jan 05 21:04:50 CST 2005


"Benji" <gy1@radiant.net> wrote in message
news:10tonn35bu0rcf9@corp.supernews.com...
> Hey folks.
>
> Thanks for all the help prior.
> I am now trying to collect the output information from a cmdline tool.
> pslist
>
> I would like to run pslist and put its contents into a variable that I can
> later write to a file.
> Can someone help me with this
>
> Thanks
>

WSH has the .Exec() method which should work for you. Here is the syntax:
http://msdn.microsoft.com/library/en-us/script56/html/wslrfExecMethod.asp


And here's an example:


Option Explicit

Dim oShell, oExec

Set oShell = CreateObject("WScript.Shell")

Set oExec = oShell.Exec("pslist.exe")

Do While oExec.Status = 0
WScript.Echo "Status: " & oExec.Status
WScript.Sleep 100
Loop

WScript.Echo "Status: " & oExec.Status & vbNewLine

WScript.Echo "StdOut: " & oExec.StdOut.ReadAll




Re: cmd tool output to variable by Benji

Benji
Mon Jan 10 13:51:48 CST 2005

Thanks thats perfect

Ryan
"Marty List" <bill.gates@sun.com> wrote in message
news:343o6mF47a5b8U1@individual.net...
>
> "Benji" <gy1@radiant.net> wrote in message
> news:10tonn35bu0rcf9@corp.supernews.com...
>> Hey folks.
>>
>> Thanks for all the help prior.
>> I am now trying to collect the output information from a cmdline tool.
>> pslist
>>
>> I would like to run pslist and put its contents into a variable that I
>> can later write to a file.
>> Can someone help me with this
>>
>> Thanks
>>
>
> WSH has the .Exec() method which should work for you. Here is the syntax:
> http://msdn.microsoft.com/library/en-us/script56/html/wslrfExecMethod.asp
>
>
> And here's an example:
>
>
> Option Explicit
>
> Dim oShell, oExec
>
> Set oShell = CreateObject("WScript.Shell")
>
> Set oExec = oShell.Exec("pslist.exe")
>
> Do While oExec.Status = 0
> WScript.Echo "Status: " & oExec.Status
> WScript.Sleep 100
> Loop
>
> WScript.Echo "Status: " & oExec.Status & vbNewLine
>
> WScript.Echo "StdOut: " & oExec.StdOut.ReadAll
>
>
>