Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all!!
Is there a way to use a batch file to edit another file without user intervention?
For example, could I use a bat file with find and edit to remove a selected line or word within another text based file?
I can easily use a batch file to open edit for a specific file but I have to type in any alterations manually.
Any help is appreciated!

I know that with BATCH files you can add certain lines but I don't know about taking out lines. I'm more skilled in Visual Basic than in Batch. Batch isn't really programming but more of a bunch of DOS commands. I know you can use the "copy" command to add to files but you have to make a file to add a file.
For example: If you wanted to add all the config.sys information to autoexec.bat (GOD ONLY KNOWS WHY :S)copy config.sys + autoexec.bat newfile.dat
It will create a newfile called newfile.dat and it will look something like this:
DEVICE=HIMEM.SYS
FILE=99
LASTDRIVE=Z
SET BLASTER=A220 I7 D3 T4
LH C:\WINDOWS\ASP4DOS.COMWhereas the top 3 lines are from config.sys and the bottom 2 are from autoexec.bat. It basically just places the first file on top of the other.
TechQuest
PS. Probably didn't help much but just as well, it might have :S.

I don't know a way to do this either, but:
If you just want to get shot of new lines that appear in an existing file, you can make a copy of the file in the form you want it, then use a batch file to copy this over to the original to restore the required situation when required.
Again not too much help, but it might aid the thought process on whatever it is you are trying to do.
Derek

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |