Install-ChocolateyFileAssociation

Install-ChocolateyFileAssociation

Install-ChocolateyFileAssociation

:choco-info: NOTE

Administrative Access Required.

Creates an association between a file extension and a executable.

Syntax

Install-ChocolateyFileAssociation `
  -Extension <String> `
  -Executable <String> `
  [-IgnoredArguments <Object[]>] [<CommonParameters>]

Description

Install-ChocolateyFileAssociation can associate a file extension with a downloaded application. Once this command has created an association, all invocations of files with the specified extension will be opened via the executable specified.

Notes

This command will assert UAC/Admin privileges on the machine.

Aliases

None

Examples

EXAMPLE 1


# This will create an association between Sublime Text 2 and all .txt
# files. Any .txt file opened will by default open with Sublime Text 2.
$sublimeDir = (Get-ChildItem $env:ALLUSERSPROFILE\chocolatey\lib\sublimetext* | select $_.last)
$sublimeExe = "$sublimeDir\tools\sublime_text.exe"
Install-ChocolateyFileAssociation ".txt" $sublimeExe

Inputs

None

Outputs

None

Parameters

-Extension <String>

The file extension to be associated.

Property Value
Aliases
Required? true
Position? 1
Default Value
Accept Pipeline Input? false

-Executable <String>

The path to the application's executable to be associated.

Property Value
Aliases
Required? true
Position? 2
Default Value
Accept Pipeline Input? false

-IgnoredArguments [<Object[]>]

Allows splatting with arguments that do not apply. Do not use directly.

Property Value
Aliases
Required? false
Position? named
Default Value
Accept Pipeline Input? false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters http://go.microsoft.com/fwlink/p/?LinkID=113216 .

Function Reference

:choco-info: NOTE

This documentation has been automatically generated from Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" -Force; Get-Help Install-ChocolateyFileAssociation -Full.

View the source for Install-ChocolateyFileAssociation