Replacing some text in .txt file or any file through VBScript,
Function ReplacePrgPath(sFilePath,FND,REPL)
Dim goFso
Dim oGFile,oFile,sFileContent
Set goFso = CreateObject("Scripting.FileSystemObject")
Set oGFile = goFso.GetFile(sFilePath)
Set oFile = oGFile.OpenAsTextStream(1, -2)
sFileContent = oFile.ReadAll
oFile.Close
Set oFile = Nothing
sFileContent = Replace(sFileContent, FND, REPL)
Set oFile = oGFile.OpenAsTextStream(2, 0)
Err.Clear
oFile.Write sFileContent
oFile.Close
Set oFile = Nothing
Set oGFile = Nothing
End Function
ReplacePrgPath sActionItem, "C:\",RDRIVE & "\"
sActionItem IS FILE NAME with PATH
"C:\" IS TEXT TO BE REPLACE
RDRIVE & "\" IS TEXT TO BE REPLACE WITH
Thank you for reading.
Nice post.
ReplyDeleteInformatica Data Quality training
Informatica idq online training
Informatica idq training
Informatica mdm online training
Informatica mdm training
Informatica message Queue online training
Informatica message Queue training
Informatica power center online training
Informatica power center training
Manual Testing online training
Manual Testing training
Microservices online training
Microservices training
Office 365 online training
Office 365 training
Open stack online training
Open stack training
Im obliged for the blog article.Thanks Again. Awesome.
ReplyDeleteteradata training
oracle bpm training
angular js training
sql server dba training