Pass shortcut arguments in .bat (batch)

Posted on


In a .exe shortcut, I can use extra arguments. But how to pass those arguments in a .bat file?


To pass argument to bat or cmd file – you just run script with parameters, like this:

script.cmd parameter1 parameter2

Inside script – if you pass arguments – you will have %1 %2 %3 special variables available, and you can use them like this

echo First argument is %1
echo Second argument is %2

echo Starting application with arguments
application.exe %1 %2

More information:

Windows batch scripting / Command line arguments at Wikibooks

EDIT / added later after discussion in comments.

To replace shortcut with command line file (cmd or bat) – create .bat or .cmd file like this:

"C:Some LocationSome application.exe" argument1 argument2

In exactly the same way:

BatchFile.bat param1 param2 ...

Inside the batch file the parameters are addressed as %1, %2, …

Leave a Reply

Your email address will not be published.