{if $mac} :getifname for /f "tokens=1* delims=," %%a in ('getmac /v /nh /fo csv^|findstr /I "{(':'|str_replace:'-':$mac)|strtoupper}"') do (set "ifname=%%a") timeout /t 1 /nobreak if '%ifname%'=='' (goto getifname) echo %ifname% {if $ip_info.ipv6} netsh interface ipv6 set privacy state=disabled store=active > nul netsh interface ipv6 set privacy state=disabled store=persistent > nul netsh interface ipv6 set global randomizeidentifiers=disabled store=active > nul netsh interface ipv6 set global randomizeidentifiers=disabled store=persistent > nul netsh interface ipv6 add address %ifname% {$ip_info.ip} > nul netsh interface ipv6 add route ::/0 %ifname% {$ip_info.gateway} > nul netsh interface ipv6 set dnsservers %ifname% static {$dns1} primary > nul netsh interface ipv6 add dnsservers %ifname% {$dns2} > nul {else} netsh interface ipv4 set address %ifname% static {$ip_info.ip} {$ip_info.mask} {$ip_info.gateway} 1 > nul netsh interface ipv4 set dnsservers %ifname% static {$dns1} primary > nul netsh interface ipv4 add dnsservers %ifname% {$dns2} > nul {/if} {if $ip_list}{foreach from=$ip_list item=m} {if $m.ipv6} netsh interface ipv6 add address %ifname% {$m.ip} > nul {else} netsh interface ipv4 add address %ifname% {$m.ip} {$m.mask} > nul {/if} {/foreach}{/if} {if !$ip_info.ipv6} netsh interface ipv6 set privacy state=disabled store=active > nul netsh interface ipv6 set privacy state=disabled store=persistent > nul netsh interface ipv6 set global randomizeidentifiers=disabled store=active > nul netsh interface ipv6 set global randomizeidentifiers=disabled store=persistent > nul {/if} {/if} {if $mac2 && $ip_private} :getifname2 for /f "tokens=1* delims=," %%b in ('getmac /v /nh /fo csv^|findstr /I "{(':'|str_replace:'-':$mac2)|strtoupper}"') do (set "ifname2=%%b") timeout /t 1 /nobreak if '%ifname2%'=='' (goto getifname2) echo %ifname2% {if $ip_info.ipv6} netsh interface ipv6 add address %ifname2% {$ip_private.ip} > nul netsh interface ipv6 set dnsservers %ifname2% static {$dns1} primary > nul netsh interface ipv6 add dnsservers %ifname2% {$dns2} > nul {else} netsh interface ipv4 set address %ifname2% static {$ip_private.ip} {$ip_private.mask} > nul netsh interface ipv4 set dnsservers %ifname2% static {$dns1} primary > nul netsh interface ipv4 add dnsservers %ifname2% {$dns2} > nul {/if} {/if}