I have 300 files and i want to add strCompN = "intNumber" to the top in all the files how do i acomplish that?
I have manage to add strCompN in one file 300 times but not strCompN 1 time in 300 files.
This is the code i have been working with.
I have manage to add strCompN in one file 300 times but not strCompN 1 time in 300 files.
This is the code i have been working with.
Code:
IntNumber = 10001
Const FOR_READING = 1
Const FOR_WRITING = 2
Do
strFileName = "C:\join.vbs"
strNewContent = ("strCompN = """&IntNumber&"""")
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objTS = objFS.OpenTextFile(strFileName,FOR_READING)
strContents = objTS.ReadAll
objTS.Close
Set objTS = objFS.OpenTextFile(strFileName,FOR_WRITING)
objTS.WriteLine strNewContent
objTS.Write strContents
IntNumber = IntNumber + 1
Loop