返回列表 发帖
echo 正在为您设置IP,请稍等......
set /A "a=%RANDOM%%%250+3
set /A "b=%RANDOM%%%250+3
set /A "c=%RANDOM%%%250+3
netsh interface ip set address name="本地连接" source=static addr=10.%a%.%b%.%c% mask=255.0.0.0
:start
set /A "num=%RANDOM%%%190+10"
ping 10.1.1.%num% -n 1
rem arp -a |find "10.1.1.%num%" &&goto start
%systemroot%\system32\arp.exe -a | %systemroot%\system32\find.exe "10.1.1.%num%" &&goto start
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
netsh interface ip set dns "本地连接" source=static addr=10.1.1.100 register=primary
netsh interface ip add dns "本地连接" addr=8.8.8.8
netsh interface ip set wins name="本地连接" source=static addr=10.1.1.100
if %errorlevel% neq 0 goto startCOPY
如果仍然有问题,请把执行过程贴出来看看那。

TOP

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

TOP

试试这样能否正确调整到:start
setlocal enabledelayedexpansion
echo 正在为您设置IP,请稍等......
set /A "a=%RANDOM%%%250+3
set /A "b=%RANDOM%%%250+3
set /A "c=%RANDOM%%%250+3
netsh interface ip set address name="本地连接" source=static addr=10.%a%.%b%.%c% mask=255.0.0.0
:start
set /A "num=%RANDOM%%%190+10"
ping 10.1.1.%num% -n 1
rem arp -a |find "10.1.1.%num%" &&goto start
%systemroot%\system32\arp.exe -a | %systemroot%\system32\find.exe "10.1.1.%num%"
echo !errorlevel!
if !errorlevel! equ 0 (
    goto :start
)
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
netsh interface ip set dns "本地连接" source=static addr=10.1.1.100 register=primary
netsh interface ip add dns "本地连接" addr=8.8.8.8
netsh interface ip set wins name="本地连接" source=static addr=10.1.1.100
if %errorlevel% neq 0 goto startCOPY

TOP

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

TOP

setlocal enabledelayedexpansion
echo 正在为您设置IP,请稍等......
set /A "a=%RANDOM%%%250+3
set /A "b=%RANDOM%%%250+3
set /A "c=%RANDOM%%%250+3
netsh interface ip set address name="本地连接" source=static addr=10.%a%.%b%.%c% mask=255.0.0.0
:start
set /A "num=%RANDOM%%%190+10"
ping 10.1.1.%num% -n 1
rem arp -a |find "10.1.1.%num%" &&goto start
arp -a >test.log
%systemroot%\system32\arp.exe -a | %systemroot%\system32\find.exe "10.1.1.%num%"
echo !errorlevel!
if !errorlevel! equ 0 (
    goto :start
)
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
netsh interface ip set dns "本地连接" source=static addr=10.1.1.100 register=primary
netsh interface ip add dns "本地连接" addr=8.8.8.8
netsh interface ip set wins name="本地连接" source=static addr=10.1.1.100
if %errorlevel% neq 0 goto startCOPY
find命令没有找到那个IP
把win7里面test.log压缩一下传上来看看
1

评分人数

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

TOP

arp的输出用的2号句柄,这样写入文件试试:
setlocal enabledelayedexpansion
echo 正在为您设置IP,请稍等......
set /A "a=%RANDOM%%%250+3
set /A "b=%RANDOM%%%250+3
set /A "c=%RANDOM%%%250+3
netsh interface ip set address name="本地连接" source=static addr=10.%a%.%b%.%c% mask=255.0.0.0
:start
set /A "num=%RANDOM%%%190+10"
ping 10.1.1.%num% -n 1
rem arp -a |find "10.1.1.%num%" &&goto start
arp -a >test.log 2>&1
%systemroot%\system32\arp.exe -a | %systemroot%\system32\find.exe "10.1.1.%num%"
echo !errorlevel!
if !errorlevel! equ 0 (
    goto :start
)
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
netsh interface ip set dns "本地连接" source=static addr=10.1.1.100 register=primary
netsh interface ip add dns "本地连接" addr=8.8.8.8
netsh interface ip set wins name="本地连接" source=static addr=10.1.1.100
if %errorlevel% neq 0 goto startCOPY

TOP

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

TOP

返回列表