How to get first line of content in textfile

November 16, 2010 at 00:17:26
Specs: Windows XP
the first line in the text file is

header FH
date 20100805
time 1230
run no 000001
countrycode(SG) 58

Using the MSDOS command
How to get the first line of content in text file?
How to retrieve the run no ?

See More: How to get first line of content in textfile

Report •

November 16, 2010 at 06:17:34
set /P line=< "MyFile.txt"

set header=%line:~0,2%
set date=%line:~2,8%
set time=%line:~10,4%
set runno=%line:~14,6%
set country=%line:~20,2%

Report •

November 21, 2010 at 19:05:15
Thank you very much, IVO.

The data length of runno is 6

total of runno is 28, how to replace the run no = 000028

The final outcome must be the following, then copy this newline to another file ---> myfile2.txt in the last line.


1) How to replace the runno with that format?
2) How to copy the newline to the last line in a myfile2.txt?

Thanks again!

Report •

Related Solutions

Ask Question