I use a Powershell window with posh-git to work with git and have grown tired of repeatedly typing cd ..\Database
, cd ..\Backend
and cd ..\Frontend
to switch between the repos I'm working with. I want to create aliases so that I can simply run db
, be
or fe
to do this.
After some reasearch and failed experimentation I was getting nowhere and found this answer which informs that aliases can't take parameters and I should use functions, so I tried that.
I can successfully change to one the desired directories with the command
Set-Location C:\Projects\Database
so I executed the following in a Powershell window to create a function
function db { set-location C:\Projects\Database }
and this executed without error. However on running db
immediately afterwards, I get the following error.
db : The term 'Set-Location C:\Projects\Database' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ db
+ ~~
+ CategoryInfo : ObjectNotFound: (Set-Location C:\Projects\Database:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I want to ultimately add commands to create the functions to my profile script, but have been unable to get past this simple block and am feeling quite frustrated that I can't get what would seem to be a simple thing to work.
Can someone help me figure this out?