批处理怎样提取文本中每一行汉字内容并赋值给变量执行命令

2025-05-01 16:24:23
推荐回答(1个)
回答1:

@echo off
setlocal enabledelayedexpansion
for /f "skip=1 tokens=*" %%a in (net.txt) do (
call :rtrip "%%~a"
netsh interface ip set dns "!line!" static 202.216.224.66
)
pause
exit /b
:rtrip
set "line=%~1"
if "%line:~-1%"==" " call :rtrip "%line:~,-1%"