Hi,
I am trying to write a value to three different files, using replace.
Since I'm no coder, I created for every file a different piece of code, probably could be written much cleaner.
Something with a loop or so ? Who can help me with this?
I am trying to write a value to three different files, using replace.
Since I'm no coder, I created for every file a different piece of code, probably could be written much cleaner.
Something with a loop or so ? Who can help me with this?
Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
r="c:\windows\setup\scripts\reboot1.reg"
Set objTextFile = objFSO.OpenTextFile(r,1)
s = objtextfile.readall
n = "####"
snew = Replace(s,n,BiosAT)
objTextFile.close
set objtextfile=nothing
' delete old file
' objfso.DeleteFile r, true
'write new file
set objTextFile = objfso.CreateTextFile(r)
objTextFile.Write snew
objTextFile.Close
set objTextFile = nothing
' Adjust second file
Set objFSO = CreateObject("Scripting.FileSystemObject")
r="c:\windows\setup\scripts\reboot2.reg"
Set objTextFile = objFSO.OpenTextFile(r,1)
s = objtextfile.readall
n = "####"
snew = Replace(s,n,BiosAT)
objTextFile.close
set objtextfile=nothing
' delete old file
' objfso.DeleteFile r, true
'write new file
set objTextFile = objfso.CreateTextFile(r)
objTextFile.Write snew
objTextFile.Close
set objTextFile = nothing
' Adjust third file
Set objFSO = CreateObject("Scripting.FileSystemObject")
r="c:\windows\setup\scripts\reboot3.reg"
Set objTextFile = objFSO.OpenTextFile(r,1)
s = objtextfile.readall
n = "####"
snew = Replace(s,n,BiosAT)
objTextFile.close
set objtextfile=nothing
' delete old file
' objfso.DeleteFile r, true
'write new file
set objTextFile = objfso.CreateTextFile(r)
objTextFile.Write snew
objTextFile.Close
set objTextFile = nothing