[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. echo 正在为您设置IP,请稍等......
  2. set /A "a=%RANDOM%%%250+3
  3. set /A "b=%RANDOM%%%250+3
  4. set /A "c=%RANDOM%%%250+3
  5. netsh interface ip set address name="本地连接" source=static addr=10.%a%.%b%.%c% mask=255.0.0.0
  6. :start
  7. set /A "num=%RANDOM%%%190+10"
  8. ping 10.1.1.%num% -n 1
  9. rem arp -a |find "10.1.1.%num%" &&goto start
  10. %systemroot%\system32\arp.exe -a | %systemroot%\system32\find.exe "10.1.1.%num%" &&goto start
  11. netsh interface ip set address name="本地连接" source=static addr=10.1.1.%num% mask=255.255.255.0 gateway=10.1.1.250 gwmetric=0 | find "IP地址已在网络上使用" &&goto start
  12. netsh interface ip set dns "本地连接" source=static addr=10.1.1.100 register=primary
  13. netsh interface ip add dns "本地连接" addr=8.8.8.8
  14. netsh interface ip set wins name="本地连接" source=static addr=10.1.1.100
  15. if %errorlevel% neq 0 goto start
复制代码
如果仍然有问题,请把执行过程贴出来看看那。

TOP

或者把那行改成这样:
  1. %systemroot%\system32\arp.exe -a 2>&1 | %systemroot%\system32\find.exe "10.1.1.%num%" &&goto start
复制代码

TOP

试试这样能否正确调整到:start
  1. setlocal enabledelayedexpansion
  2. echo 正在为您设置IP,请稍等......
  3. set /A "a=%RANDOM%%%250+3
  4. set /A "b=%RANDOM%%%250+3
  5. set /A "c=%RANDOM%%%250+3
  6. netsh interface ip set address name="本地连接" source=static addr=10.%a%.%b%.%c% mask=255.0.0.0
  7. :start
  8. set /A "num=%RANDOM%%%190+10"
  9. ping 10.1.1.%num% -n 1
  10. rem arp -a |find "10.1.1.%num%" &&goto start
  11. %systemroot%\system32\arp.exe -a | %systemroot%\system32\find.exe "10.1.1.%num%"
  12. echo !errorlevel!
  13. if !errorlevel! equ 0 (
  14.     goto :start
  15. )
  16. netsh interface ip set address name="本地连接" source=static addr=10.1.1.%num% mask=255.255.255.0 gateway=10.1.1.250 gwmetric=0 | find "IP地址已在网络上使用" &&goto start
  17. netsh interface ip set dns "本地连接" source=static addr=10.1.1.100 register=primary
  18. netsh interface ip add dns "本地连接" addr=8.8.8.8
  19. netsh interface ip set wins name="本地连接" source=static addr=10.1.1.100
  20. if %errorlevel% neq 0 goto start
复制代码

TOP

你的Win7是32位的还是64位的?

TOP

  1. setlocal enabledelayedexpansion
  2. echo 正在为您设置IP,请稍等......
  3. set /A "a=%RANDOM%%%250+3
  4. set /A "b=%RANDOM%%%250+3
  5. set /A "c=%RANDOM%%%250+3
  6. netsh interface ip set address name="本地连接" source=static addr=10.%a%.%b%.%c% mask=255.0.0.0
  7. :start
  8. set /A "num=%RANDOM%%%190+10"
  9. ping 10.1.1.%num% -n 1
  10. rem arp -a |find "10.1.1.%num%" &&goto start
  11. arp -a >test.log
  12. %systemroot%\system32\arp.exe -a | %systemroot%\system32\find.exe "10.1.1.%num%"
  13. echo !errorlevel!
  14. if !errorlevel! equ 0 (
  15.     goto :start
  16. )
  17. netsh interface ip set address name="本地连接" source=static addr=10.1.1.%num% mask=255.255.255.0 gateway=10.1.1.250 gwmetric=0 | find "IP地址已在网络上使用" &&goto start
  18. netsh interface ip set dns "本地连接" source=static addr=10.1.1.100 register=primary
  19. netsh interface ip add dns "本地连接" addr=8.8.8.8
  20. netsh interface ip set wins name="本地连接" source=static addr=10.1.1.100
  21. if %errorlevel% neq 0 goto start
复制代码
find命令没有找到那个IP
把win7里面test.log压缩一下传上来看看
1

评分人数

    • beck1321: 很认真 期待能够成功技术 + 1

TOP

arp的输出用的2号句柄,这样写入文件试试:
  1. setlocal enabledelayedexpansion
  2. echo 正在为您设置IP,请稍等......
  3. set /A "a=%RANDOM%%%250+3
  4. set /A "b=%RANDOM%%%250+3
  5. set /A "c=%RANDOM%%%250+3
  6. netsh interface ip set address name="本地连接" source=static addr=10.%a%.%b%.%c% mask=255.0.0.0
  7. :start
  8. set /A "num=%RANDOM%%%190+10"
  9. ping 10.1.1.%num% -n 1
  10. rem arp -a |find "10.1.1.%num%" &&goto start
  11. arp -a >test.log 2>&1
  12. %systemroot%\system32\arp.exe -a | %systemroot%\system32\find.exe "10.1.1.%num%"
  13. echo !errorlevel!
  14. if !errorlevel! equ 0 (
  15.     goto :start
  16. )
  17. netsh interface ip set address name="本地连接" source=static addr=10.1.1.%num% mask=255.255.255.0 gateway=10.1.1.250 gwmetric=0 | find "IP地址已在网络上使用" &&goto start
  18. netsh interface ip set dns "本地连接" source=static addr=10.1.1.100 register=primary
  19. netsh interface ip add dns "本地连接" addr=8.8.8.8
  20. netsh interface ip set wins name="本地连接" source=static addr=10.1.1.100
  21. if %errorlevel% neq 0 goto start
复制代码

TOP

能否把17楼生成的test.log压缩一下传上来看看?

TOP

返回列表