I am using SSIS script task to replace text in text file. In my VB script hard coded file path in script but I want to use user variable instead.
Const ForReading = 1
Const ForWriting = 2
Dim objFSO, objFile, strText, strNewText
objFSO = CreateObject("Scripting.FileSystemObject")
objFile = objFSO.OpenTextFile("C:\Users\newtons\Desktop\Text.txt", ForReading)
strText = objFile.ReadAll
objFile.Close()
strNewText = Replace(strText, "Jim", "James")
objFile = objFSO.OpenTextFile("C:\Users\newtons\Desktop\Text.txt", ForWriting)
objFile.WriteLine(strNewText)
objFile.Close()
objFSO = Nothing
objFile = Nothing

