How to make a batch file edit a text file
Posted
by William
on Stack Overflow
See other posts from Stack Overflow
or by William
Published on 2010-03-31T16:53:22Z
Indexed on
2010/03/31
18:23 UTC
Read the original article
Hit count: 434
I got the code
Set objFS = CreateObject("Scripting.FileSystemObject")
strFile = "C:\test\file.txt"
Set objFile = objFS.OpenTextFile(strFile)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
If InStr(strLine,"ex3")> 0 Then
strLine = Replace(strLine,"ex3","ex5")
End If
WScript.Echo strLine
Loop
The strLine replacing part i can fix myself to use with my own purposes, but how do i do something like this so that it doesn't require the file's name, it just edits all text files within the document?
© Stack Overflow or respective owner