< Back

Set-PSFTypeAlias

Sun Jan 19, 2020 6:45 pm

NAME Set-PSFTypeAlias



SYNOPSIS

Registers or updates an alias for a .NET type.





SYNTAX

Set-PSFTypeAlias [-AliasName] <String> [-TypeName] <String> [<CommonParameters>]



Set-PSFTypeAlias [-Mapping] <Hashtable> [<CommonParameters>]





DESCRIPTION

Registers or updates an alias for a .NET type.

Use this function during module import to create shortcuts for typenames users can be expected to interact with

directly.





PARAMETERS

-AliasName <String>

The short and useful alias for the type.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TypeName <String>

The full name of the type.

Example: 'System.IO.FileInfo'



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Mapping <Hashtable>

A hashtable of alias to typename mappings.

Useful to registering a full set of type aliases.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Set-PSFTypeAlias -AliasName 'file' -TypeName 'System.IO.File'



Creates an alias for the type 'System.IO.File' named 'file'









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Set-PSFTypeAlias -Mapping @{



file = 'System.IO.File'

path = 'System.IO.Path'

}



Creates an alias for the type 'System.IO.File' named 'file'

Creates an alias for the type 'System.IO.Path' named 'path'











RELATED LINKS