ZTree.com  | ZEN  | About...  

 Index   Back

[General] is there a way to append two lines to many text files?   [General]

By: Ryan       
Date: Jan 09,2022 at 17:46
In Response to: [General] is there a way to append two lines to many text files? (Ben Kent)

trying to apply AA= on the top of BB= was a mistake for my batch level. i always leave AA= to #ZTTtag. i dont know much about how BB='s operators work but i got a help for it. at least i could modify it to what and where to insert

i dont know why 1. didnt work
1. for /L %%A in (1+SKIP 1 end) this one should have worked
2. for /L %%A in (1+%SKIP% 1 end) number + string numer dont mix

<"!file!" > this kind of way was over my head.
and this line too. set "line1="& set /p "line1=" it didnt stop me for a prompt.
i had fun finishing this batch in the mist and made it work
thanks for your help as always.

for %%A in ("*.bat") do (
set file="%%~A"

@echo off &setlocal

set "file=%~1"
set /A SKIP=4
set /A REST=SKIP+1

setlocal EnableDelayedExpansion
<"!file!" >"!file!.~tmp" (
for /f %%i in ('type "!file!"^|find /c /v ""') do (

for /L %%A in (1 1 %SKIP%) do (
set "line1="& set /p "line1="

REM -------------------------------------------
echo FOR /F "Tokens=*" %%%%V IN ('TYPE %%K0%%'^) DO (SET K1=%%%%V^)
REM -------------------------------------------
for /L %%A in (%REST% 1 %%i) do (
set "line2="& set /p "line2="
>nul move /y "!file!.~tmp" "!file!"


Messages in this Thread

96,664 Postings in 12,235 Threads, 350 registered users, 200 users online (0 registered, 200 guests)
Index | Admin contact |   Forum Time: Jun 16, 2024 - 2:25 pm UTC  |  Hits:64,848,048  (58,108 Today )
RSS Feed