Maybe I'm misunderstanding the problem but nslookup does have a noninteractive mode... so wouldn't what you want be:

nslookup -q=mx mymailserver.mycompany.com

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/nslookup.mspx