yajiu 当前离线
列兵
评分人数
GNU 当前离线
上尉
TOP
setlocal enabledelayedexpansion set file=test.txt set line_num=0 for /f %%i in (%file%) do set /a line_num+=1 set /a "line=%random% %% %line_num%" set /a line+=1 set line_num=0 for /f "tokens=1-3" %%i in (%file%) do ( set /a line_num+=1 if !line_num!==%line% ( set "Var1=%%i" set "Var2=%%j" set "Var3=%%k" echo %%i echo %%j echo %%k pause ) ) set name=本地连接 set ipint=ip set ip=%Var2% set mask=255.255.255.0 set gateway=192.168.1.1 set dns1=8.8.8.8 set dns2=202.96.128.86 echo %ip% pause set ipint=ipv4 netsh interface %ipint% set address name="%name%" source=static addr=%ip% mask=%mask% gateway=%gateway% gwmetric=0 netsh interface %ipint% set dns name="%name%" source=static addr=%dns1% register=primary netsh interface %ipint% add dns name="%name%" addr=%dns2% index=2 pause ipconfig /all复制代码
ygqiang 当前在线
少尉
回复 yajiu addr=%Var2% ygqiang 发表于 2016-8-8 06:11
set name=本地连接 set ipint=ip set ip=%Var2% set mask=255.255.255.0 set gateway=192.168.1.1 set dns1=8.8.8.8 set dns2=114.114.114.114 echo %ip% pause ver|find "5.2" >nul&&goto :continue||goto :Other :Other set ipint=ipv4 :continue netsh interface %ipint% set address name="%name%" source=static addr=%ip% mask=%mask% gateway=%gateway% gwmetric=0 netsh interface %ipint% set dns name="%name%" source=static addr=%dns1% register=primary netsh interface %ipint% add dns name="%name%" addr=%dns2% index=2 pause&exit复制代码
set networdaddress=mac set mac=%Var3% for /f "skip=1 delims=[]" %%i in ('wmic nic where 'netconnectionid like "本地连接%%"' get caption') do set numnet=%%i set regpath=HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\%numnet:~-4% reg add "%regpath%" /v "MAC Address" /d "%mac%" /f reg add "%regpath%\Ndi\Params\NetworkAddress" /ve /d "%%mac" /f reg add "%regpath%\Ndi\Params\NetworkAddress" /v "ParamDesc" /d "MAC Address"复制代码
xxpinqz (YiFeng)当前离线
中校
@echo off set/an=%random%%%50+2 for /f "tokens=2" %%a in ('findstr /n . ip.txt^|findstr /bc:"%n%:"')do ( echo,netsh int ipv4 set add .....%%a echo,netsh int ipv4 set dns ..... ) pause复制代码