脚本编码使用ANSI
CMD代码页使用默认的936 (chcp 936)
脚本内容:
@echo off
setlocal ENABLEEXTENSIONS
setlocal ENABLEDELAYEDEXPANSION
setlocal
title %~f0 自动重连NV模组,请不要关闭,重启电脑请用管理员权限启动此脚本
REM chcp get 936
REM chcp 65001
set FULLNAME=%~f0
set FILENAME=%~nx0
set DIR=%~dp0
REM chcp936, File Encoding: ANSI
set KEYWORD_NETWORK_ADAPTER=以太网适配器 以太网
set KEYWORD_IP=IPv4 地址
set KEYWORD_AUTO_IP=自动配置 IPv4 地址
set KEYWORD_DHCP=DHCP 服务器
set KEYWORD_DESCRIPTION=描述 Remote NDIS Compatible Device
REM chcp 65001, not work with chinese language with output of ipconfig command
REM set KEYWORD_IP=IPv4 Address
REM set KEYWORD_DHCP=DHCP Server
echo.
set /a loop_counter=0
:RESCAN
for /f "usebackq skip=2 tokens=1-10 delims=.: " %%i in (`ipconfig /all