0
在此先感謝強制回車一批
我有一個批處理文件,讀取1500 +文件,找到一個特定的文本行,然後插入四個單獨的字符串。但是我需要每個字符串都在自己的行上。以下是工作代碼的副本。 「工作」除了所有四個字符串都在一行上。我需要四條線。
@echo off
setlocal EnableExtensions EnableDelayedExpansion
FOR %%G IN (E:\SweepstakesNinja\sweepstakesninja\sweepstakesfilesCustomSubmissions\) DO DEL /Q %%G
pause
set SrcFolder=E:\SweepstakesNinja\sweepstakesninja\sweepstakesfiles
set DstFolder=E:\SweepstakesNinja\sweepstakesninja\sweepstakesfilesCustomSubmissions
set "echotext0=[**]details==>>mainsweepstakessubmissiontype||==||3"
set "echotext1=[**]details==>>prizevalue||==||"
set "echotext2=[**]details==>>startdate||==||2010.01.01"
set "echotext3=[**]details==>>mainid||==||0"
for %%a in ("%SrcFolder%\*.txt") do (
for /f "usebackq delims=" %%h in ("%%~a") do (
echo.%%h
if "%%h" equ "[**]details==>>countries||==||" (echo !echotext0!!echotext1!!echotext2!!echotext3!)^
else if "%%h" equ "[**]details==>>countries||==||USA" (echo !echotext0!!echotext1!!echotext2!!echotext3!)^
else if "%%h" equ "[**]details==>>countries||==||USA, Canada" (echo !echotext0!!echotext1!!echotext2!!echotext3!)^
else if "%%h" equ "[**]details==>>countries||==||USA,Canada" (echo !echotext0!!echotext1!!echotext2!!echotext3!)
)
) > "%DstFolder%\%%~nxa"
echo DONE
BD
嘗試將其更改爲'(echo!echotext0!&echo!echotext1!&echo!echotext2!&echo!echotext3!)' – Compo
ninjaproger您的建議完美運行。我以爲我嘗試了所有的變化。 – bdecker