General discussion

Locked

Batch to Pull Text from Another File

By BorgInva ·
It is at the tip of my tongue but I can not think of it.

For Windows 2000 and XP, I need to make my batch file grab the first 3 lines of another file.

So I want my batch file to look at another file and grab the first 3 lines of it, append to a new file, so I make append more info to it and make a whole new file.

Can that be done. I think it can but forget how.

Thanks.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by gsquared In reply to Batch to Pull Text from A ...

I'm not certain a batch file can do that. I know how to get VBA to do it. I know how to get T-SQL to do it. I've done a lot of tasks with batch files, but I'm not sure what you're asking can be done.

I took a look through the XP command shell documentation at:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_o.mspx?mfr=true

I didn't see anything that would do what you're looking for. I didn't look all that thoroughly, so I may have overlooked something. Take a look at the command references on that page and see if you can find something.

I think it would be easier, however, to set up a script to do it, rather than trying to use a command prompt batch file. Since it can be done in VBA, you might try doing it through the Word VBA editor (create a macro). The OpenTextFile method of the FileSystem object is the one to use, if you use that solution.

If you have an IDE for a real programming language and can build a stand-alone application, use whatever objects/methods that language uses. If not, but you do have Word/Excel/Access, you can build a macro for it. Not as convenient as a .bat file, but it will work.

Or perhaps someone else will be able to suggest a means of doing it through a batch file.

Collapse -

by Chris910 In reply to Batch to Pull Text from A ...

Check out the multipul solutions in this reference by:
_____
Prof. Timo Salmi
Co-moderator of news:comp.archives.msdos.announce
Moderating at ftp:// & http://garbo.uwasa.fi/
Department of Accounting and Business Finance ; University of Vaasa
____


ftp://garbo.uwasa.fi/pc/link/tscmd.zip
1CMDFAQ.TXT --> Solution 23

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums