Author Topic: A little Batch problem..  (Read 5967 times)

0 Members and 1 Guest are viewing this topic.

October 07, 2008, 03:04:39 pm
Read 5967 times

JohnC

  • Special Members
  • Hero Member

  • Offline
  • *

  • 1964
I wanted to lookup a list of domains and find the NX ones. Thought it would be a simple enough task, but it seems when there is a NX domain it doesn't redirect the text to the file I specify, it redirects it to the command prompt. Somebody told me it is based on the return code of the program, if it returns 0 it will redirect to a file, and if it is an error return code like a -1 it would output to the screen. Again I thought this would be simple enough to check use an if ERRORLEVEL, but nslookup always returns 0 unless I'm doing something wrong.

So I'm looking for suggestions to achieve what I want.

Under linux everything is redirected to the file I specify *shrug*.

October 07, 2008, 06:50:41 pm
Reply #1

cjeremy

  • Special Members
  • Full Member

  • Offline
  • *

  • 58
    • sudosecure
so would a simple 2>&1 redirect work for you.... ie

./nslookup_script.pl > myout 2>&1

?????

October 07, 2008, 08:35:52 pm
Reply #2

JohnC

  • Special Members
  • Hero Member

  • Offline
  • *

  • 1964
Thank you cjeremy :)