Wednesday, December 19, 2012

Commandline parameter in batch script

It is very easy to pass the commandline arguments to any batch script. Mainly the parameters are available at the variables %0, %1, %2 ... etc. The %0 holds the name of the batch script, and others are the parameters.

Here is sample script named test.bat:
echo off
echo %0
echo %2
echo %1

Running the script using following command with no second argument available:

D:\work>test.bat "commandline param"


ECHO is off.
"commandline param"

Running the script using the following command:

D:\work>test.bat "commandline param" hello


"commandline param"

No comments:

Get function name programaticaly - Python

This little piece of code will help you to get the function name programatically. This is very helpful when you are implementing the debug...