请教用.bat 处理命令批量处理某个文件里的内容

2025-03-27 04:31:21
推荐回答(1个)
回答1:

不需要生成 temp.txt 真蜘蛛.txt 这两个临时文件。

③④⑤可以直接合并为 读取 nslookup ip 结果有Baiduspider把IP保存到 真蜘蛛IP.txt,否则把IP保存到 假蜘蛛IP.txt 。

@echo off
cd .>真蜘蛛IP.txt
cd .>假蜘蛛IP.txt
for /f %%i in (IP.txt) do (
  nslookup %%i 2>nul|findstr /i baiduspider >nul&&>>真蜘蛛IP.txt echo %%i||>>假蜘蛛IP.txt echo %%i
)
pause