- 1 year ago
Is PHP CLI on Windows hardcoded for cmd.exe, or can I somehow make it use PowerShell?
Comment
1 / 1
The PHP CLI (Command-Line Interface) on Windows is typically associated with the cmd.exe
command prompt by default. However, you can still execute PHP scripts using PowerShell by explicitly specifying the PHP executable.
To run PHP scripts using PowerShell, you can use the following command:
powershellphp.exe -f path/to/script.php
Replace path/to/script.php
with the actual path to your PHP script.
By explicitly specifying php.exe
, you can bypass the default association with cmd.exe
and run PHP scripts in PowerShell.
Note that the behavior and features available in the PHP CLI may vary depending on the version of PHP you're using and any additional configuration or extensions you have installed.