6

I have seen the documentation for creating own alias but its little confusing. can anyone help me and simply say me what to do? I think it will help a lot of people, because i saw few questions related to this on stackoverflow but it really hard to get. Thank you.

John
  • 301
  • 4
  • 12

2 Answers2

10

If you can use git bash:

  • Open bash.bashrc (usually found at => C:\Program Files\Git\etc)
  • Create your alias (Example => alias art='php artisan' )
  • Save and Exit
miken32
  • 42,008
  • 16
  • 111
  • 154
Yusuf Onur Sari
  • 394
  • 2
  • 9
1

There is another way for Windows users. I want to set pa for php artisan

Step 1) Create pa.bat file

First I create a folder for example C:\Aliases and create a file called pa.bat inside that folder. Then, I need to write following lines inside C:\Aliases\pa.bat

@echo off
echo.
php artisan %*

Step 2) Edit PATH environment variable

And I also need to add C:\Aliases in my PATH environment variable.
To do so, just search "edit env" and you will find "Edit environment variables for your account", then click on "Path", then "Edit", then add C:\Aliases to the list.

Step 3) Use the alias

Now, just close terminal and open it again. And now you can just use pa instead of php artisan. For example :

pa serve --port=8800
pa make:controller
pa migrate:fresh

This way, you can set alias for any command in windows. If you like to see more ways to set aliases in Windows, you can check out this question in stackoverflow: Aliases in Windows command prompt

eylay
  • 1,712
  • 4
  • 30
  • 54