Jump to content

How to do a nslookup in a batch file and make it print to a txt file.

Matapatapa

Im in the middle of a small programming assignment right now, and am stumped. What needs to be done is->

 

Create a batch file called yourfirstname.cmd

to perform the following steps:

·       If the value of the userdomain variable is equal to the value of the computername variable then

Store into a file called yourfirstname.txt the following information:

                                                         i.    The current username

                                                       ii.    The current computername

                                                      iii.    The nslookup information for www.disney.com

 

How far ive gotten on the other hand is so= 

 

IF USERDOMAIN == COMPUTERNAME GOTO Text

:Text
echo.>"C:\Abdullah.txt"
rem Saved in C:\cake.txt
echo USERNAME >> cake.txt
echo COMPUTERNAME >> cake.txt

 

This task itself is easy, but I only really know C#, and not batch. The syntax is a mystery to me, and ive spent a while looking at stackoverflow which has helped me get this far ( no idea if it even works ) , but I cant figure out how to do the nslookup and save it into the txt file. 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×