@user2782162 您需要编辑您的问题并更具体。我根据您正在尝试做的“我认为”创建了以下批次。
请让我们知道这是否是您想要的?另外......我确信@Magoo 可以让这变得更简单(你是一个奇才)。
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET listloc=list.txt
:start
FOR /f "tokens=* delims= " %%a IN (%listloc%) DO CALL :process1 %%a
ECHO.
ECHO List finished - Press any key to close.
PAUSE >nul
GOTO :eof
:process1
SET fname=%2
IF "%2"=="" GOTO :eof
:process2
ECHO %1=%2 >>%fname%.txt
SHIFT
SHIFT
IF NOT "%2"=="" GOTO process2
GOTO :eof
这是假设您的输入文件“list.txt”的排列方式如下......每个“新文件”的所有信息都在这样的单独行上......
list.txt 的内容
customer=hello1 fromAddress=email1@domain.com andOrAddress=OR1 toAddress=email1@domain.com outputPath=E:\Exgest\customer\email@domain1.com outputFormat=MIME1 customHeaders=true1 fromDate=200309011 toDate=201012311
customer=hello2 fromAddress=email2@domain.com andOrAddress=OR2 toAddress=email2@domain.com outputPath=E:\Exgest\customer\email@domain2.com outputFormat=MIME2 customHeaders=true2 fromDate=200309012 toDate=201012312
customer=hello3 fromAddress=email3@domain.com andOrAddress=OR3 toAddress=email3@domain.com outputPath=E:\Exgest\customer\email@domain3.com outputFormat=MIME3 customHeaders=true3 fromDate=200309013 toDate=201012313
批处理将一次读取 'list.txt' 1 行。它将使用每一行上“客户”的值作为新文件的名称。
下面的示例显示了第一行的输出将是什么样子..
hello1.txt 的内容
customer=hello1
fromAddress=email1@domain.com
andOrAddress=OR1
toAddress=email1@domain.com
outputPath=E:\Exgest\customer\email@domain1.com
outputFormat=MIME1
customHeaders=true1
fromDate=200309011
toDate=201012311