{"id":10225,"date":"2021-12-05T07:10:46","date_gmt":"2021-12-05T07:10:46","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=10225"},"modified":"2021-12-05T07:11:06","modified_gmt":"2021-12-05T07:11:06","slug":"solved-batch-script-to-copy-lines-from-one-text-file-to-another","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/batch-script-to-copy-lines-from-one-text-file-to-another\/30788.html","title":{"rendered":"Solved Batch Script To Copy Lines From One Text File To Another"},"content":{"rendered":"<p>Hi,<\/p>\n<p>Below script is used to copy lines from a text file to other<\/p>\n<p>May i know how can I use the below script to copy the text at the beginning of the output file. Currently it is appending at the end of the file<\/p>\n<p>@ECHO OFF<br \/>\nsetlocal enabledelayedexpansion<\/p>\n<p>SET \/P maxlines=Enter number of lines to be moved to new txt document:<br \/>\nSET \/A linecount=0<\/p>\n<p>FOR \/F &#8220;delims=&#8221; %%A IN (textfile1.txt) DO (<br \/>\nIF !linecount! GEQ %maxlines% GOTO ExitLoop<br \/>\nECHO %%A &gt;&gt; C:\\users\\username\\desktop\\textfile2.txt<br \/>\nSET \/A linecount+=1<br \/>\n)<\/p>\n<p>:ExitLoop<br \/>\nECHO All Done.<br \/>\nECHO.<br \/>\nECHO Press any key to close this window.<br \/>\nPAUSE&gt;NUL<br \/>\nEXIT<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":55},"question-category":[55],"question_tags":[],"class_list":["post-10225","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/10225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=10225"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=10225"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=10225"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=10225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}