When installing Magento 2, you may experience the command prompt error: PHP is not recognized as an internal or external command, operable program or batch file.
To fix the error follow the below steps.
- In search type Environment Variables
- Click Environment Variables button
- Click Path to open window
- Click New button and add C:\xampp\php (find the correct path by navigating to the xampp\php folder in Windows explorer).
You can now run commands such as php bin/magento setup:static-content:deploy to deploy Magento 2