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
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