Skip to content

New-CommanderFileAssociation

SYNOPSIS

Creates a file association that will invoke the action when it's opened.

SYNTAX

New-CommanderFileAssociation [-Extension] <String> [-Action] <ScriptBlock> [<CommonParameters>]

DESCRIPTION

Creates a file association that will invoke the action when it's opened.

EXAMPLES

EXAMPLE 1

New-CommanderFileAssociation -Extension ".ps2" -Action {
    Start-Process code -ArgumentList $Args[0]
}

Starts VS Code and opens the opened PS2 file.

PARAMETERS

-Extension

The extension to associate with the action.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Action

The action to execute when the file type is opened. $Args[0] will be the full file name of the file opened.

Type: System.Management.Automation.ScriptBlock
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

Back to top