0

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.

1

1 Answer 1

2

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 ...)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.