Powershell Command : New-Alias

New-Alias :

It was used for creating new alias.

New-Alias Description :

The New-Alias cmdlet is used for creating new alias in the current session of the Powershell. The alias created by this cmdlet was not saved by default, you need to export the alias to a file and once again you need to import to save it.

New-Alias Syntax :

Parameter Set: Default
New-Alias [-Name] <String> [-Value] <String> [-Description <String> ] [-Force] [-Option <ScopedItemOptions> ] [-PassThru] [-Scope <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

New-Alias Parameters :

-PassThru

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

-Name<String>

Use to specify the new alias. Here you can use the alphanumeric characters.

-Force

It will act like set-alias cmdlet.

-Description<String>

Used for specifying the description.

-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.

-Value<String>

Used to specify the name of the cmdlet.

-Option<ScopedItemOptions>

Sets the value of the Options property of the alias.

-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.

New-Alias Examples :

1) This command creates an alias named list for replacing the command get-childitem.

PS C:> new-alias list get-childitem

You may also like...

Leave a Reply

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