@echo off
arp -d
for /f "tokens=1* delims=:" %%a in ('ipconfig /all^|find /i "Physical Address"') do set mac=%%b
for /f "tokens=1* delims=:" %%a in ('ipconfig /all^|find /i "IP Address"') do set ip=%%b
for /f "tokens=16 delims=." %%c in ('ipconfig ^| findstr "IP Address"') do set netkey=%%c
arp -s %ip:~1% %mac:~1%
REG add "HKLM\SYSTEM\CurrentControlSet\Services\NwlnkIpx\Parameters" /v VirtualNetworkNumber /t REG_DWORD /d %netkey% /f
按照您的指点我的批处理是不是应该写成:
①
@echo off
arp -d
for /f "tokens=1* delims=:" %%a in ('ipconfig /all^|find /i "Physical Address"') do set mac=%%b
for /f "tokens=1* delims=:" %%a in ('ipconfig /all^|find /i "IP Address"') do set ip=%%b
for /f "tokens=16 delims=." %%c in ('ipconfig ^| findstr "IP Address"') do set netkey=%%c
arp -s %ip:~1% %mac:~1%
REG add "HKLM\SYSTEM\CurrentControlSet\Services\NwlnkIpx\Parameters" /v VirtualNetworkNumber /t REG_DWORD /d 0x3fb %netkey% /f
②
@echo off
arp -d
for /f "tokens=1* delims=:" %%a in ('ipconfig /all^|find /i "Physical Address"') do set mac=%%b
for /f "tokens=1* delims=:" %%a in ('ipconfig /all^|find /i "IP Address"') do set ip=%%b
for /f "tokens=16 delims=." %%c in ('ipconfig ^| findstr "IP Address"') do set netkey=%%c
arp -s %ip:~1% %mac:~1%
REG add "HKLM\SYSTEM\CurrentControlSet\Services\NwlnkIpx\Parameters" /v VirtualNetworkNumber /t REG_DWORD /d %netkey% 0x3fb /f
应该是①还是②呢?