引号是特殊字符,需要一个替换再还原的过程.
下面代码使用前提: a.txt每行只有一对 ""- @echo off
- setlocal enabledelayedexpansion&cls
- ::==============================================================
- :start
- for /f "tokens=1,2,3* usebackq delims=" %%a in ("a.txt") do (
- set "fline=%%a"
- set "fline=!fline:"=☆!"
- for /f "tokens=1,2,3* delims=☆" %%i in ("!fline!") do (
- set "a1=%%j"
- set "a1=!a1:,=!"
- echo %%i"!a1!"%%k>>youfile.txt
- )
- )
复制代码
|