我想通读一个包含很多行的文本文件。 在每一行的开头,我有一个引号之间的字符串,然后是一个昏迷,然后是其余的行,例如:
"CBL003","C3/C5 // <>SdcdUB","",0,1,"PfcdDT_gerergv","",0,"","",0,"","",0,"","",0,"","",0,"","",0,"","",0,"","",0,"","",0,"","",
"CBL004","C3<.<C7 // <>SqsxUB","",0,1,"PDzesdxT_esfdczec","",0,"","",0,"","",0,"","",0,"","",0,"","",0,"","",0,""
我想要的是读取文件,并提取第一行将其放在不同的文本文件中,并用它包含的行的第一个字符串命名。例: 在上面的例子中,我应该有包含以下内容的文本文件CBL003.txt:
"CBL003","C3/C5 // <>SdcdUB","",0,1,"PfcdDT_gerergv","",0,"","",0,"","",0,"","",0,"","",0,"","",0,"","",0,"","",0,"","",0,"","",
和第二个文件文本CBL004.txt包含:
"CBL004","C3<.<C7 // <>SqsxUB","",0,1,"PDzesdxT_esfdczec","",0,"","",0,"","",0,"","",0,"","",0,"","",0,"","",0,""
我已经有一个代码可以读取每一行:
FOR /F "tokens=*" %%a IN (C:\SourceFile.txt) DO (
ECHO %%a
)
但我不知道如何提取每行的第一部分