批处理文件运行两次

时间:2019-05-02 14:34:14

标签: file batch-file

我一直试图弄清楚为什么这段代码运行两次,我需要您的帮助以找出我做错了什么地方。

setlocal EnableDelayedExpansion

for /F "tokens=*" %%A in  (inFile) do  (
   echo %%A >> Out.txt
)
endlocal

inFile有一些数据:

Process1
Process2

运行批处理文件时,Out.txt将具有:

Process1
Process1
Process2
Process2

请注意,在运行批处理文件之前,我已清除Out.txt

1 个答案:

答案 0 :(得分:0)

尝试将:end放在最后一行代码goto end的末尾

相关问题