Find & Replace Script from WjServer

Status
Not open for further replies.

l0calh0st

Active Member
4,052
2010
713
10
Hey you may have already seen this tool in WjServer, but here it is again. Free for wjunction webmasters/coders! :D

Open notepad and copy/paste this. Save it as: replace.vbs
Code:
Const ForReading = 1
Const ForWriting = 2

strFileName = Wscript.Arguments(0)
strOldText = Wscript.Arguments(1)
strNewText = Wscript.Arguments(2)

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

strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, strOldText, strNewText)

Set objFile = objFSO.OpenTextFile(strFileName, ForWriting)
objFile.WriteLine strNewText
objFile.Close
Finally open notepad again and copy/paste this. Save it as: replace.bat
Code:
@echo off
color 0c
title I love wjunction!
echo.
echo I love wjunction again!
cscript replace.vbs "C:\Path\To\Target.txt" "ReplaceThisWith" "This"
pause
This script will find & replace ALL "ReplaceThisWith" with "This" from the file: C:\Path\To\Target.txt

Btw: you can also use Dreamweaver to find&replace :P
But this is just oldskool that i love.

CheeerZ B-)
 
Status
Not open for further replies.
Back
Top