PowerTip: Easily Create a Script that Creates PowerShell Aliases

Doctor Scripto

Summary: Learn how to run a one-line Windows PowerShell command to create a Windows PowerShell script that automatically recreates all of your aliases.

Hey, Scripting Guy! Question I want to create a script that will create a standardized set of Windows PowerShell aliases for my environment. I need to do this in a single line. How can I easily do this?

Hey, Scripting Guy! Answer Use the Export-Alias cmdlet and specify the –As script parameter. Provide a path to store the script, as shown here.

Export-Alias -As script -Path c:\fso\aliases.ps1


Discussion is closed.

Feedback usabilla icon