How can I pass arguments to a batch file?

arguments, batch-file

Solution

Here's how I did it:

@fake-command /u %1 /p %2

Here's what the command looks like:

test.cmd admin P@55w0rd > test-log.txt

The `%1` applies to the first parameter the `%2` (and here's the tricky part) applies to the second. You can have up to 9 parameters passed in this way.

Problem

I need to pass an ID and a password to a batch file at the time of running rather than hardcoding them into the file. Here's what the command line looks like: ``` test.cmd admin P@55w0rd > test-log.txt ```

Original source

Related problems