# File_ReplaceInFile

> Searches file for specified text-string and replace it with a new string.

Source: https://docs.capaone.com/capainstaller/vb-scripting-library/file-functions/file-replaceinfile/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

#### Description

Searches file for specified text-string and replace it with a new string

### Syntax

File_ReplaceInFile(sFile, sSearchString, sReplacementString, bOnlyFirstOccurence, bIgnoreCase) As Boolean

### Parameters

#### sFile (String)

Source-file

#### sSearchString (String)

String to replace

#### sReplacementString (String)

New string

#### bOnlyFirstOccurence (Boolean)

Only first matching string will be replaced

#### bIgnoreCase (Boolean)

Ignore case

### Example

**VBScript**

```vb
If bStatus Then bStatus = File_ReplaceInFile("C:\CapaInstaller.txt", "1999", "2000", False, True)
```

[Scripting Guidelines](/capainstaller/vb-scripting-library/scripting-guidelines/)

### Related functions

[File_AppendToFile](/capainstaller/vb-scripting-library/file-functions/file-appendtofile/) [File_FindInFile](/capainstaller/vb-scripting-library/file-functions/file-findinfile/) [File_GetLineString](/capainstaller/vb-scripting-library/file-functions/file-getlinestring/) [File_InsertInFile](/capainstaller/vb-scripting-library/file-functions/file-insertinfile/) [Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/)
