< Back

Import-Alias

Tue Jan 29, 2019 10:22 pm

NAME Import-Alias



SYNOPSIS

Imports an alias list from a file.





SYNTAX

Import-Alias [-Confirm] [-Force] -LiteralPath <String> [-PassThru] [-Scope <String>] [-WhatIf] [<CommonParameters>]



Import-Alias [-Path] <String> [-Confirm] [-Force] [-PassThru] [-Scope <String>] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The Import-Alias cmdlet imports an alias list from a file.



Beginning in Windows PowerShell 3.0, as a security feature, Import-Alias does not overwrite existing aliases by default. To overwrite an existing

alias, after assuring that the contents of the alias file is safe, use the Force parameter.





PARAMETERS

-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Force [<SwitchParameter>]

Allows the cmdlet to import an alias that is already defined or is read only. You can use the following command to display information about

the currently-defined aliases:



`Get-Alias | Select-Object name,Options`



If the corresponding alias is read-only, it will be displayed in the value of the Options property.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-LiteralPath <String>

Specifies the path to a file that includes exported alias information. Unlike the Path parameter, the value of the LiteralPath parameter is

used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single

quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-PassThru [<SwitchParameter>]

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Path <String>

Specifies the path to a file that includes exported alias information. Wildcards are allowed but they must resolve to a single name.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-Scope <String>

Specifies the scope into which the aliases are imported. The acceptable values for this parameter are:



- Global



- Local



- Script



- A number relative to the current scope (0 through the number of scopes, where 0 is the current scope and 1 is its parent)





The default is Local. For more information, see about_Scopes.





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

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 (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String

You can pipe a string that contains a path to Import-Alias .





OUTPUTS

None or System.Management.Automation.AliasInfo

When you use the Passthru parameter, Import-Alias returns a System.Management.Automation.AliasInfo object that represents the alias.

Otherwise, this cmdlet does not generate any output.





NOTES









Example 1: Import aliases from a file



PS C:\\>Import-Alias test.txt



This command imports alias information from a file named test.txt.



RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkId=821812

Export-Alias

Get-Alias

New-Alias

Set-Alias