I have a PowerShell script that opens all files and programs related to my development environment. Rather than typing
> &.\mysetup.ps1
is there some way I can alias it to just type
> gosetup
?
Ideally I’ll use this functionality for other PowerShell scripts as well! For reference, I want to run these commands from the Git PowerShell window.
In your profile, add the following lines:
Open a new shell, and you should be able to call your script by its alias.
Update / Additional Information
If you want to simply assign a one-liner, or a short snip of code to an alias, you don’t need to put it into a script file, as described above, you can simply create a function in your profile: