Reputation: 11128
I have php script, that take some arguments from command line. Something like:
php script.php user create
I need to create windows cmd file, that will call my php script, and it will pass arguments to php script.
I need to call it like:
command.cmd user create
Command.cmd source now:
php script.php
What I need to add, to send undefined number of arguments from cmd file to php script.
Upvotes: 0
Views: 742
Reputation: 437356
Simply add %*
at the end of the command line:
php script.php %*
This forwards all the command line arguments of the batch file to the script.
For reference, doing CALL /?
from the command line shows (among others):
%* in a batch script refers to all the arguments (e.g. %1 %2 %3 %4 %5 ...)
Upvotes: 2