批处理替换 + 为 | 再输出是个问题;- @echo off
- setlocal EnableDelayedExpansion
- cd /d "%~dp0"
- set src="Text1.txt"
-
- set tmpfile="%temp%\~%random%~"
- (
- for /f "tokens=1* delims=]" %%A in ('type %src%^|find /n /v ""') do (
- set "s=%%B"
- if defined s (
- set "s=!s:+=|!"
- for %%C in ("!s!") do echo,%%~C
- ) else (
- echo,
- )
- )
- )>%tmpfile%
- move /y %tmpfile% %src%
- endlocal
- pause
- exit /b
复制代码
|