悬赏:怎样处理BAT中的特殊字符

2024-12-19 03:34:09
推荐回答(2个)
回答1:

@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in (t.txt) do (
set /a n+=1
if !n!==3 (
for /f "tokens=1-5 delims==|\-" %%a in ("%%i") do (
set "var=%%b"
call,set var=%%var:.= %%
call:sub %%var%%
call,set var="%%a=%%var%%|%%c-%%var%%\%%e"
echo !var:"=!
)
) else (
echo/%%i
)
)
pause>nul

:sub
set /a add=%4+1
call,set var=%1.%2.%3.%%add%%
goto:eof

回答2:

用^| 和 ^\ 转义一下