New-Alias - PowerShell


 

Creates a new alias. (New-Alias)

   

# NAME
New-Alias

# SYNOPSIS
Creates a new alias.

# SYNTAX
New-Alias [-Name] <string> [-Value] <string> [-Description <string>] [-Force] [-Option {None | ReadOnly | Constant | Private | AllScope}] [-PassThru] [-Scope <string>] [-Confirm] [-WhatIf] [<CommonParameters>]

# DESCRIPTION
The New-Alias cmdlet creates a new alias in the current Windows PowerShell session. Aliases created by using New-Alias are not saved after you exit the session or close Windows 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.

# PARAMETERS
-Description <string>
Specifies a description of the alias. You can type any string. If the description includes spaces, enclose it in quotation marks.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Force [<SwitchParameter>]
If set, act like set-alias if the alias named already exists.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Name <string>
Specifies the new alias. You can use any alphanumeric characters in an alias, but the first character cannot be a number.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false

-Option <ScopedItemOptions>
Sets one or more optional properties of the alias. Valid values are:

-- None: Sets no options. (default)

-- ReadOnly: The alias cannot be changed unless you use the Force parameter.

-- Constant: The alias cannot be changed, even by using the Force parameter.

-- Private: The alias is available only within the scope specified by the Scope parameter. It is invisible in all other scopes.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-PassThru [<SwitchParameter>]
Returns an object representing the new alias. By default, this cmdlet does not generate any output.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Scope <string>
Specifies the scope of the new alias. 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.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Value <string>
Specifies the name of the cmdlet or command element that is being aliased.

Required? true
Position? 2
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false

-Confirm [<SwitchParameter>]
Prompts you for confirmation before executing the command.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-WhatIf [<SwitchParameter>]
Describes what would happen if you executed the command without actually executing the command.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
None
You cannot pipe input to this cmdlet.

# OUTPUTS
None or System.Management.Automation.AliasInfo
When you use the Passthru parameter, New-Alias generates a System.Management.Automation.AliasInfo object representing the new alias. Otherwise, this cmdlet does not generate any output.

# NOTES

To create a new alias, use Set-Alias or New-Alias. To change an alias, use Set-Alias. To delete an alias, use Remove-Item.

# EXAMPLE 1

C:\PS>new-alias list get-childitem

# Description
-----------
This command creates an alias named "list" to represent the Get-ChildItem cmdlet.

# EXAMPLE 2

C:\PS>new-alias -name w -value get-wmiobject -description "quick wmi alias" -option ReadOnly

C:\PS> get-alias -name w | format-list *

# Description
-----------
This command creates an alias named "w" to represent the Get-WMIObject cmdlet. It creates a description, "quick wmi alias", for the alias and makes it read only. The last line of the command uses Get-Alias to get the new alias and pipes it to Format-List to display all of the information about it.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=113352
Set-Alias
Get-Alias
Export-Alias
Import-Alias

C:\Windows>powershell get-help New-TimeSpan -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows 10, 8.1, 8, 7, Vista / Windows Server 2016, 2012, 2008
»»»» ColorConsole








Windows-10





Windows-10

... facebook.de
... Windows-10 FAQ
... Windows-10 Info


Become a Sponsor
... Your button here?





PowerShell: Creates a new alias.

HTTP: ... PS_Windows/en/New-Alias.htm
0.218
7886

Is there the Quad-Directory File Manager for Linux or Mac OS X?

 /

Neue Registerkarte (Tab) im Vordergrund öffnen, Firefox und IE, aber wie?

 /

Open next directory in new file explorer window!

 /

Can I save and open searches in Windows 7 ?

 /

How can i pictures and posters print from File Explorer Views?

 /

Windows 8.1/10 WordPad finden, starten und öffnen!

 /

Welche Bedeutung haben die "Rot" angezeigten Dateien im Explorer?

 /

Was ist Windows PE (WinPE)?

 /

Die neue CPU mal richtig belasten und im Windows 10 Task-Manager beobachten!

 /

Warnhinweise auf den Schachteln!

 /

Bug Fix Q-Dir blank List View on Windows 10 / 8.1!

 /

Quickly edit Windows 10 Autostart Folder!

 /