Поделиться через


Using the Import-Alias Cmdlet

Importing Saved Windows PowerShell Aliases

If you can export all your Windows PowerShell aliases using the Export-Alias cmdlet then it seems only fitting and proper that you can import those aliases using the Import-Alias cmdlet. To import a saved alias file simply call Import-Alias followed by the file path:

Import-Alias c:\scripts\alias.txt

Note that Import-Alias does not delete or overwrite any existing Windows PowerShell aliases. For example, suppose you have an alias named xyz that maps to the Get-ChildItem cmdlet. Let’s further suppose that your text file also has an alias named xyz, this one mapping to the Get-Help cmdlet. When you import the file your version of xyz will not be overwritten; instead, Windows PowerShell will inform you that an alias named xyz already exists, and leave well enough alone. Import-Alias will only import aliases (based on name) that don’t currently exist in your Windows PowerShell environment.

Import-Alias Aliases
  • ipal