See this article on TechNet[^]
Further information available.
This
link[
^] provides a script for updating text within a file using VBScript. There is an annoying pop-up on that site so I will reproduce the post here...Note I have not tested this personally.
waitely wrote:
If you want to edit a specific line in a file through VBScript you can use something like below. This reads the original file line by line and writes it out to a temporary file. If the original line meets the condition you want, make the changes required. At the end, close both files, delete the original and move the temp file.
Const ForReading=1
Const ForWriting=2
Set objFSO = CreateObject("Scripting.FileSystemObject")
folder = "C:\Program Files\Vendor\"
filePath = folder & "file.txt"
Set myFile = objFSO.OpenTextFile(filePath, ForReading, True)
Set myTemp= objFSO.OpenTextFile(filePath & ".tmp", ForWriting, True)
Do While Not myFile.AtEndofStream
myLine = myFile.ReadLine
If InStr(myLine, "Variable=") Then
myLine = "Variable="&whatever
End If
myTemp.WriteLine myLine
Loop
myFile.Close
myTemp.Close
objFSO.DeleteFile(filePath)
objFSO.MoveFile filePath&".tmp", filePath