Table of contents
ISE
TOC
Collapse the table of content
Expand the table of content

Import-Alias

JuanPablo Jofre|Last Updated: 11/22/2016
|
3 Contributors

SYNOPSIS

Imports an alias list from a file.

SYNTAX

ByPath (Default)

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

ByLiteralPath

Import-Alias -LiteralPath <String> [-Scope <String>] [-PassThru] [-Force] [-WhatIf] [-Confirm]
 [<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.

EXAMPLES

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

PS C:\>import-alias test.txt

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

PARAMETERS

-Force

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.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Returns an object that represents the alias. By default, this cmdlet does not generate any output.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: No output
Accept pipeline input: False
Accept wildcard characters: False

-Path

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

Type: String
Parameter Sets: ByPath
Aliases: 

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: True

-Scope

Specifies the scope into which the aliases are imported. Valid values are "Global", "Local", or "Script", or a number relative to the current scope (0 through the number of scopes, where 0 is the current scope and 1 is its parent). "Local" is the default. For more information, see about_Scopes.

Type: String
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: Local
Accept pipeline input: False
Accept wildcard characters: False

-LiteralPath

Specifies the path to a file that includes exported alias information. Unlike Path, 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.

Type: String
Parameter Sets: ByLiteralPath
Aliases: PSPath

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

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

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: False
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 (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

Export-Alias

Get-Alias

New-Alias

Set-Alias

© 2016 Microsoft