I am using PHP and Yii Framework, so I need to call php yii with each command. To make this just a little bit more handy, following this example, I have created run.bat file, with this content:
@echo off
php yii %*
I have placed it in %SystemRoot% (c:\WINDOWS\), so it is accessible system wide, from any path.
To my extreme surprise I have found the following:
- Command-line (Terminal in Windows 11): Both
runandrun.batworks just fine. - Windows PowerShell: Both
runandrun.batworks just fine. - Terminal inside PhpStorm: Must use
run.batbecauserundoesn't work:
In the same time both php and yii works in PhpStorm like I charm and I am not forced to execute php.exe or yii.bat.
What am I missing? What changes should I introduce to file content or file location (or maybe PATH system variable) to be able to use just run in PhpStorm?

echo %PATHEXT%in CMD will show what file extensions are used and in what order when you try to execute yourrunwithout.bat)php.exeandyii.batyou should still use their full paths, and extensions:@"%~dp0php.exe" "%~dp0..\htdocs\yii\framework\yii.bat" %*. It is almost always prudent to explicitly define the working directory at the outset of your scripts, (this allows for you to use relative locations if you prefer). You should never rely upon%PATH%or%PATHEXT%, being preset with your required content, (doing so also adds a time overhead). I'd have to ask why you aren't usingyiic.bat, which is the console interface script.%PATH%in anywhere. If there will be no path tophp.exeexecutable defined then nothing will work, both my scripts andphp yiicall. Theyiicis a PHP script from versio 1.1 of Yii Framework. It was replaced withyiiin version 2.0. I am using it directly. As in question -- my script is just an shorthand to callyinstead ofphp yiias so far. Nothing else. Theyiiscript is still responsible for all the magic here. I am not changing this in any way.%PATHEXT%, and you explained in the body text, item 1. that%PATH%is relied upon!%PATHEXT%includes extensions only (no paths). While it truly has.cmdlisted, in my approach I am not using this extension. I am executingycommand which callsyfile, noty.cmd.