# Sys_SetFileAssociation

> Sets file association for a given extension.

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

### Description

Sets file association for a given extension

### Syntax

Sys_SetFileAssociation(sExtenstion, sAction, sCommand, bOverwriteExisting) As Boolean

### Parameters

#### sExtenstion (String)

System restore point description

#### sAction (String)

The action to create

#### sCommand (String)

The command to execute when the action is activated

#### bOverwriteExisting (String)

Overwrite association if it already exists

### Example

**VBScript**

```vb
'Program.exe takes a file as a launch parameter which is supplied by Windows by %1
If bStatus Then bStatus = Sys_SetFileAssociation(".extension", "Open", gsProgramFiles & "\Program\Program.exe %1", True)
```

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

### Related functions

[Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/)
