Forwarding all batch file parameters to inner comm

2019-03-17 13:25发布

问题:

For my comfort in Windows, I want to prepare some PHP tools launched like in Unix.

f.e.: composer create-project symfony/framework-standard-edition path/

Not: php composer.phar create-project symfony/framework-standard-edition path/

I made composer.bat file in system path dir:

php C:\path\to\composer\composer.phar

and its works in simply usage. But how to forward all parameter and flags to command inside?

回答1:

in your batch file composer.bat, simply put:

php C:\path\to\composer\composer.phar %*


回答2:

windows gives you %* to refer to all parameters.

Your new composer.bat file will then become
php C:\path\to\composer\composer.phar %*