Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

windows 7 cmd batch file need to copy text file to another file excluding the first two lines

lovebug

Active Coder
hi guys, thanks in advance 😀

so ive written a windows .bat file that compiles my code and other things, all working fine

i would like to add to this a command that can copy default.txt to final.txt but only from lines 3 onwards skipping the first two lines

ive been unable to find a command to do this in cmd's help

i hope someone has help, thanks
 
This is real easy once you know the command to use:
Code:
echo > final.txt
for /f "skip=2 tokens=*" %%s in (default.txt) do (
    echo %%s >> final.txt
)
 
thanks for the reply

all i get is a file generated with "echo is off" and none of the text from the original file
 
it was making a total mess of things, i added a delims which helped a bit but its deleting all the new lines hmmm
Code:
rem --------------------------------------------------
rem  update README.md with new build number
rem --------------------------------------------------
echo Build %bbcProjectBuildBin% > ..\readme.build
for /f "skip=1 delims=¬" %%s in (..\README.md) do (
    echo %%s >> ..\readme.build
    )
del /q ..\README.md
ren ..\readme.build README.md
 
this worked 100% thanks 😀
Code:
echo Build %bbcProjectBuildBin%> ..\readme.build.md
for /f "skip=1 tokens=*" %%s in (..\README.md) do (
    echo %%s>> ..\readme.build.md
    )
del /q ..\README.md
ren ..\readme.build.md README.md

and heres the generated README.md output on github https://github.com/LoveBug2084/LadyBug

thanks 😀
 
i do my game development with beebasm and beebem running on this laptop in windows 7, no reason i guess

i could use linux mint for development, just means reinstalling everything 🙁
 
i do my game development with beebasm and beebem running on this laptop in windows 7, no reason i guess

i could use linux mint for development, just means reinstalling everything 🙁
Ah gotcha. Hope you don't mind the no longer support for Win 7 from good ol Microsoft
 
Strange that my lines initially resulted in an empty file for you. I tested them and they worked exactly like you wanted, make a copy of the file but minus the first two lines. Anyway, good you got it sorted out now.
 
Back
Top Bottom