CmdID

CmdID / PowerShell / Cmdlets / New

New-Alias

Creates a new alias. PowerShell reference

From the PowerShell reference 9 parameters Alias nal

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Creates a new alias. The New-Alias cmdlet creates a new alias in the current PowerShell session. Aliases created by using New-Alias are not saved after you exit the session or close PowerShell. You can use the Export-Alias cmdlet to save your alias information to a file. You can later use Import-Alias to retrieve that saved alias information.

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

Create an alias for a cmdlet

New-Alias -Name "List" Get-ChildItemIdentify

Create a read-only alias for a cmdlet

New-Alias -Name "C" -Value Get-ChildItem -Description "Quick gci alias" -Option ReadOnly Get-Alias -Name "C" | Format-List *Identify

Create an alias for a command with parameters

function Set-ParentDirectory {Set-Location -Path ..} New-Alias -Name .. -Value Set-ParentDirectoryIdentify

Its page in the reference: New-Alias.

Parameters

9 in the PowerShell reference
-DescriptionSpecifies a description of the alias. You can type any string. If the description includes spaces, enclose it in quotation marks.
-ForceIndicates that the cmdlet acts like Set-Alias if the alias named already exists.
-NameSpecifies the new alias. You can use any alphanumeric characters in an alias, but the first character cannot be a number.
-OptionSpecifies the value of the Options property of the alias. Valid values are: - None: The alias has no constraints (default value) - ReadOnly: The alias can be deleted but cannot be changed except by using the Force parameter - Constant: The alias cannot be deleted or changed - Private: The alias is available only in the current scope - AllScope: The alias is copied to any new scopes that are created - Unspecified: The option is not specified These values are defined as a flag-based enumeration. You can combine multiple values together to set multiple flags using this parameter. The values can be passed to the Option parameter as an array of values or as a comma-separated string of those values. The cmdlet will combine the values using a binary-OR operation. Passing values as an array is the simplest option and also allows you to use tab-completion on the values. To see the Options property of all aliases in the session, type Get-Alias | Format-Table -Property Name, Options -AutoSize.
-PassThruReturns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
-ScopeSpecifies the scope of the new alias. 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). Local is the default. For more information, see about_Scopes.
-ValueSpecifies the name of the cmdlet or command element that is being aliased.
-ConfirmPrompts you for confirmation before running the cmdlet.
-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.