Import-Alias
Published: February 29, 2012
Updated: August 15, 2012
Applies To: Windows PowerShell 2.0, Windows PowerShell 3.0
Import-Alias
Aliases
The following abbreviations are aliases for this cmdlet:
- ipal
Syntax
Parameter Set: ByPath Import-Alias [-Path] <String> [-Force] [-PassThru] [-Scope <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>] Parameter Set: ByLiteralPath Import-Alias -LiteralPath <String> [-Force] [-PassThru] [-Scope <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed 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
-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.
|
Aliases |
none |
|
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.
|
Aliases |
none |
|
Required? |
false |
|
Position? |
named |
|
Default Value |
No output |
|
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.
|
Aliases |
none |
|
Required? |
true |
|
Position? |
1 |
|
Default Value |
none |
|
Accept Pipeline Input? |
true (ByValue, ByPropertyName) |
|
Accept Wildcard Characters? |
true |
-Scope<String>
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.
|
Aliases |
none |
|
Required? |
false |
|
Position? |
named |
|
Default Value |
Local |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-LiteralPath<String>
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.
|
Aliases |
none |
|
Required? |
true |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
true (ByValue, ByPropertyName) |
|
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
|
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.
|
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, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
-
System.String
You can pipe a string that contains a path to Import-Alias.
Outputs
The output type is the type of the objects that the cmdlet emits.
-
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.
Examples
-------------------------- EXAMPLE 1 --------------------------
This command imports alias information from a file named test.txt.
PS C:\> import-alias test.txt
Related topics