Jump to content

Search & Replace string


Guest Marauder2k
 Share

Recommended Posts

Guest Marauder2k

I have a standard text file which I'd like to search for a string, replace it, and save the file again.

The main part I'm having trouble with is the filewrite command. How can I get it to actually replace the string instead of just adding the new changed string to the end of the file?

This is what I have so far:

$file = FileOpen("setup1.txt", 1)
$aaa=StringReplace("%programfiles%", "programfiles", @programfilesdir, 0, 0)
FILEWRITE($file, $aaa)
FILECLOSE($file)

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...