Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WScript Stdin/out and Shell

Status
Not open for further replies.

SRG

MIS
Jan 28, 1999
105
CA
I am an MCSE, so it's clear that I don't know all thet much on the programming side. I am trying to get a vbscript to do a simple task for me.

Currently I pipe results of a command into a text file, then parse these results for what I need. A friend of mine said I could proably skip the Text file step. This I would like. He sent me the following code (doesn't work for me) as an example. I did goof with it a bit is something is way out of place.

Can anyone help me get the output from applications run in a shell back into my script?

option explicit
dim objWshShell
Set objWshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo = nslookup ("Set objWshShell = NOTHING


Function NSLookup (strHostName)
dim junk,x
dim strAddress, strName
Set objWshShell = WScript.CreateObject("WScript.Shell")
set x = objWshShell.exec("nslookup " & strHostName)
junk = x.StdOut.SkipLine()
msgbox junk
junk = x.StdOut.SkipLine()
msgbox junk
junk = x.StdOut.SkipLine()
msgbox junk
junk = x.StdOut.SkipLine()
msgbox junk
NSLookup = replace (x.StdOut.ReadLine(), "Address: ", "")
Set objWshShell = NOTHING
end function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top