Re: readLine method help
- From: Kendoh <Kendoh@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 25 Apr 2005 08:34:11 -0700
I really appreciate your help... What you suggested worked. My only remaining
question is this... Is there a way to make the cmd execution window not
appear as the script is running, or to minimize it? Because the script is
using nslookup, a cmd prompt flashes each time the command is executed. Is
there a way to make it so the window doesn't open?
"Torgeir Bakken (MVP)" wrote:
> Kendoh wrote:
>
> > Now I have this problem... I am trying to get all computers of a subnet into
> > a txt file. Here is the code. I am not getting any output... When I use your
> > code without the if loop, it writes localhost into the document... What am I
> > doing wrong?
> >
> > dim fso, fl, count
> > count = 1
> > ip = 1
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set fl = fso.CreateTextFile("C:\\Temp\Test.txt", true)
> >
> > if count <> 256 Then
> > Set objShell = CreateObject("WScript.Shell")
> > Set objWshScriptExec = objShell.Exec("nslookup 158.187.145.&count&")
> > (snip)
> Hi,
>
> You are trying to use nslookup against 158.187.145.&count&.
> You will need to put the count variable outside the quoted string.
>
> Change
> ("nslookup 158.187.145.&count&")
> to
> ("nslookup 158.187.145." & count)
>
> and see if it helps.
>
>
> I assume you are going to make a loop eventually, so you should also
> "reset" the strName variable inside the loop to avoid inheriting
> previous value if the 'If Left(strLine, 5) = "Name:" Then' test doesn't
> kick in.
>
> So change
>
> Set objStdOut = objWshScriptExec.StdOut
>
> Do Until objStdOut.AtEndOfStream
>
>
> to
>
> Set objStdOut = objWshScriptExec.StdOut
>
> strName = ""
> Do Until objStdOut.AtEndOfStream
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx
>
.
- Follow-Ups:
- Re: readLine method help
- From: Torgeir Bakken \(MVP\)
- Re: readLine method help
- References:
- readLine method help
- From: Kendoh
- Re: readLine method help
- From: Torgeir Bakken \(MVP\)
- Re: readLine method help
- From: Kendoh
- Re: readLine method help
- From: Torgeir Bakken \(MVP\)
- readLine method help
- Prev by Date: DCOM Launch Permissions using VBScript
- Next by Date: HTA Text input & enter key?
- Previous by thread: Re: readLine method help
- Next by thread: Re: readLine method help
- Index(es):
Relevant Pages
|
Loading