'Replace the given string with new string in the given file
'Usage:
' CScript Replace.vbs [FileName] [oldString1] [newString1] ([oldString2] [newString2] ...)

Const ForReading = 1    
Const ForWriting = 2

strFileName = Wscript.Arguments(0)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFileName, ForReading)
strText = objFile.ReadAll
objFile.Close

For i = 1 to Wscript.Arguments.Length-2 step 2
	strText = Replace(strText, Wscript.Arguments(i), Wscript.Arguments(i+1))
Next

Set objFile = objFSO.OpenTextFile(strFileName, ForWriting)
objFile.WriteLine strText
objFile.Close