Batch Script Parameters
Posted on 2007-10-10
I want to be able to process variables from the run prompt of my batch script. Example: pingbatch 192.168.1.1 -n 4 -w 1000 -i 32 where 192.168.1.1 = destination address, where -n = number of times to ping, where -w = time to wait in milliseconds and where -i = Time to Live.
I want full error checking so that it does not matter what order they are entered in (except the destination address, this should always be %1) then for example %2 could equal -n, -w or -i, %3 would be the result for %2 which could be -n, -w, -i and so on.
What is the easiest way to build this error checking into my batch file so that I am then able to process the following command with the correct parameters: ping -w 1000 -n 4 -i 32 192.168.1.1 but using variables taken from the %1, %2, %3, etc.