I want to insert a string of text say "hello" in a particular line say n (12 or 23 or some other number) using batch script. I know batch script is bad but unfortunately the requirement for this is batch script.
Here's what I've tried
@echo off
setlocal enableextensions disabledelayedexpansion
set "nthline=TEXT"
(for /f "usebackq tokens=* delims=" %%a in (c.txt) do (
echo(%%a
if defined nthline (
echo(%nthline%
set "nthline="
)
))
This code I got from here but it only inserts to the second line I cannot make it go beyond that.
Here is what the text file contains
aaaa
bbbb
cccc
dddd
ffff
gggg
hhhh
It inserts the string after aaaa. How can I make it insert at bbbb or ffff I'm new to batch scripting so Any help is greatly appreciated