Maybe the title of this question is not totally accurate so I will demonstrate it via code:
We have in Linux something like the code below:
sudo update-alternatives --set php /usr/bin/php$(phpVersion)
Which then gives you the ability to use php as a command like below:
php artisan migrate --seed
Recently I need something like this on windows,
I have added that address to Environment Variables so it is a tested solution which did not answer and should directly be done via cmd
It's needed for a DevOps CMD Task