by Ken Task.
php-cgi.exe is what your web service uses for php scripts.
You need a php cli exe. Any moodle .php script in a cli directory of moodle code can only be executed by the PHP for CLI.
Might review:
https://docs.moodle.org/en/Windows_installation
and focus on something for php cli scripts.
Comments: for what it's worth ...
shame on you Windows experts in these forums!!!!
maybe it's time to learn some Linux?
'SoS', Ken