ActiveXperts Network Monitor 2015 proactively manages network servers, devices, databases and more.

Set-Alias - PowerShell 1.0

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.

Set-Alias


Description
Back up your Hyper-V VMs Easy & Fast. 100% built for Hyper-V. Free for 2 VMs, forever.

Usage


Options
-name string[]
       The alias to create, the first character cannot be a number.
	   
   -value string
       The name of the cmdlet or command element that is being aliased.
		
   -description string
       A description for the alias.

   -option option
       The valid options are: 
         None    : Set no options. (default) 
         ReadOnly: The alias cannot be changed unless you use -Force. 
         Constant: The alias cannot be changed, even by using -Force. 
         Private : The alias is available only within the scope specified by -Scope. 
                   It is invisible in all other scopes.

   -passThru 
       Pass the object created by this cmdlet through the pipeline. 

    -scope string
        The scope in which this alias is valid. 
        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, type "get-help about_scope".

   -force
       If set, act like set-alias if the alias named already exists.
        
   -whatIf
       Describe what would happen if you executed the command without actually
       executing the command.
       
   -confirm
       Prompt for confirmation before executing the command.

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Example(s)
Create an alias named 'list' to represent Get-ChildItem:

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

Create a ReadOnly alias named 'w' to represent Get-WMIObject:

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

Uses Get-Alias to display all the information about the alias called 'List':

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

Associate the alias, "np", with the executable file for Notepad:

PS C:\>Set-Alias np c:\windows\notepad.exe

Create a function that will set location as C:\windows\system32 and then assign the alias "cd32", to the new function:

PS C:\>function func32 {set-location c:\windows\system32}
PS C:\>set-alias cd32 func32