×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VBScript FAQ

Applications

Retrieving the output from a command line by JPBERGEZ
Posted: 14 Mar 03

The following code uses the Windwos 2OOO RSK tool whoami to identify the current user ans his group membership, then retrieve the output from this command to display it. I know it's not wonderful but this is an example


Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")

'The tool is launched
Set oExec = WshShell.Exec("Whoami /all")

'We wait for the end of process
Do While oExec.Status = 0
     WScript.Sleep 100
Loop

'We scan and display the command output flow
Do While oExec.StdOut.AtEndOfStream <> True
          Wscript.Echo oExec.StdOut.ReadLine
Loop


Remarks:
* does'nt work with shell commands (dir, type etc...)
* The stdOut.ReadLine can be replaced with a StdOut.Read(1) to allow reading the stdOut character by character.
* The StdOut property does exist too. Not yet tested.

Back to VBScript FAQ Index
Back to VBScript Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close