#3135 - 2000-05-26 08:41 AM
Capturing output
|
Anonymous
Anonymous
Unregistered
|
Hi all. Has anyone ever seen this problem? I am creating a script that does NSLOOKUP commands on a text file. The script loops through each line in the text file, creates a variable, and dumps it into the command statement to run the NSLOOKUP. When there is no more names, the script exits. All this works fine, however; nothing seems to grab the output the NSLOOKUP command creates (ie. the IP address and FQN). I have tried REDIRECTOUTPUT, which only redirects error/success codes associated with running the command (it's run from a SHELL command). I have also tried SHELLing a ECHO command, but it only echo's the NSLOOKUP command line with the FQN variable. I have run out of ideas. I would appreciate any help/feedback. thanks all. Here's the script so far, still in progress: SETCONSOLE ("HIDE") ; ; /////////////////////////////////////// ; ////////// ////////// ; ////////// IPC.Kix ////////// ; ///////// ///////// ; //////////////////////////////////// ; ; Used to compare the IP address of a domain by NSLOOKUP to the info in the SQL database $SELECTION = MESSAGEBOX ("This program reads domain names from a pre-defined text file called 'wwwname.txt'. While the program runs, you will not see any screen activity. When the program is finished, it will automatically terminate. Hit OK to continue or Cancel to abort.", "NOTICE", 65) IF $SELECTION = "2" GOTO Cancel ENDIF REDIRECTOUTPUT ("d:\docs\junk.txt") BREAK ON Open (1, "d:\docs\wwwname.txt") Open (2, "d:\docs\var1.txt", 5) $N = "d:\docs\var1.txt" ; ; $X = Readline (1) WHILE @ERROR = 0 IF $X = "" GOTO End ENDIF Writeline (2, "$X" + chr (13) + chr (10)) SLEEP 2 CLOSE (2) OPEN (2, "d:\docs\var1.txt") $C = Readline (2) ; Nslookup -[options] [name] [server] (for non-interactive only) CLS DIM $Result $Result = "Nslookup www." + $C + " d1.fipc.net" REDIRECTOUTPUT ("") REDIRECTOUTPUT ("d:\docs\var2.txt") SHELL ("%COMSPEC% CMD/C $Result") ;SHELL ("%COMSPEC% CMD/C ECHO $Result >> d:\docs\var2.bat") this doesn't work Open (3, "d:\docs\var3.txt", 5) WriteLine (3, "$Result" + chr (13) + Chr (10)) SLEEP 1 CLS $X = Readline (1) CLOSE (2) DEL ("d:\docs\var1.txt") OPEN (2, "d:\docs\var1.txt", 5) REDIRECTOUTPUT ("") Loop Close (3) Close (2) Close (1) :END DEL ("d:\docs\var1.txt") $SELECTION = MESSAGEBOX ("Program Finished", "DONE", 64,3) IF $SELECTION = "1" QUIT ENDIF EXIT :Cancel ; user pushed the cancel button, exiting the script before it ran MESSAGEBOX ("Program aborted", "EXIT", 16,3) EXIT
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1452 anonymous users online.
|
|
|