I have the code to loop through a file with a list of servers followed by executing the nslookup command.
Code
setlocal EnableDelayedExpansion
set file=servers.txt
FOR /F %%i IN (%file%) DO (
set server=%%i
nslookup !server!
)
Issues
Since your batch file is called nslookup
- the line nslookup !server!
is calling the batch script itself with the argument !server!
(of course this argument is not being used), instead of the actual nslookup
command.
To fix the issue, you need to rename the batch file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.