Powershell Command : Import-Alias

Import-Alias :

Used to Import a list of alias from a file.

Import-Alias Description :

The Import-Alias cmdlet is used to import the aliases(alternate names for executable files and commands) and will overwrite the existing alias cmdlets. To overwrite the default alias cmdlets you need you need to use the Force parameter.

Import-Alias 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>]

Import-Alias Parameters :

-PassThru

It was used to return the objects that represents the alias.

-Force

It was used for importing the alias from a file and will replace the default alias.

-Path<String>

Used for specifying the path.

-Scope<String>

Used to get the aliases in specified scope. Valid values are “Global”, “Local”, or “Script”, or a number relative to the current scope.

-LiteralPath<String>

It was also used for specifying the path to a file. Unlike Path, the value of the LiteralPath parameter is used exactly as it is typed.

-Confirm

It will prompt you for a confirmation before running a cmdlet.

-WhatIf

It will show what happens when the cmdlet runs.

CommonParameters:

-Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable.

Import-Alias Examples :

1) This command imports the alias information from a file.

PS C:> import-alias test.txt

Leave a Reply

Your email address will not be published. Required fields are marked *