Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.
Option Explicit Dim fso,strFilename,strSearch,strReplace,objFile,oldContent,newContent strFilename="C:\Files\Test1.txt" strSearch="Thomas" strReplace="Tom" 'Does file exist? Set fso=CreateObject("Scripting.FileSystemObject") if fso.FileExists(strFilename)=false then wscript.echo "file not found!" wscript.Quit end if 'Read file set objFile=fso.OpenTextFile(strFilename,1) oldContent=objFile.ReadAll 'Write file newContent=replace(oldContent,strSearch,strReplace,1,-1,0) set objFile=fso.OpenTextFile(strFilename,2) objFile.Write newContent objFile.Close
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.