r/PowerShell • u/Rulylake • Dec 09 '25
Question Make custom commands in Powershell
Can you make a custom command in powershell, and if so, how?
I want to make a command that does:
git add -A
git commit -m "catchup"
git pull
In one go.
Also, feel free to tell me if making a lot of commits with the same name to pull is bad practice, though i want this for small projects with friends :)
30
Upvotes
View all comments
Show parent comment
3
u/Hefty-Possibility625 Dec 09 '25 edited Dec 09 '25
Add-Content -Path $PROFILE -Value ...This is essentially opening your profile and adding whatever content to the end. You can do something similar and more by using
notepad $PROFILEor if you're using VB Codecode $PROFILE, pasting the function and saving it. Then restart Windows Terminal or create a new session to use it.$PROFILE is just referencing the file that holds your PowerShell profile. You can add functions to this, change the way that your terminal functions, set environment variables, import modules, etc. Basically, your profile is just a PowerShell script that runs each time you start a new PowerShell session.
So, if you open your profile (
code $PROFILE) and put something like:Write-Host "Have a nice day~"then every time you open PowerShell it'll print that message.