nslookup for SRV records (or any non-A records) in non-interactive mode

Is the anyway to run nslookup (Centos 5 or Windows) such that it will look up record types other than A, without having to go to interactive mode and using set type=? For example, I'd like a command like the following:

nslookup --type=SRV _ldap._tcp.mydomain.com

You actually almost had it. On both window (at least my Win7 box I have here) and Ubuntu you would do nslookup -type=SRV _ldap._tcp.mydomain.com (notice the single dash)


This work for me

nslookup -q=SRV _ldap._tcp.mydomain.com 

So nslookup -q=SRV _sip._tls.tan-ha.com

Server:  myhost.local  
Address:  1.2.3.4 (my ip)

Non-authoritative answer:  
_sip._tls.tan-ha.com    SRV service location:  
          priority       = 100  
          weight         = 1  
          port           = 443  
          svr hostname   = sipdir.myotherdomainorso.com  

sipdir.myotherdomainorso.com  internet address = 110.12.23.34  
sipdir.myotherdomainorso.com  AAAA IPv6 address = 1111:111:ffff:3004::35

It appears the nslookup man page isn't correct anymore.

nslookup doesn't have a powerful non-interactive mode:

      "Non-interactive mode is used to print just the name and
       requested information for a host or domain"

Instead, use host(1):

host -t SRV example.com