i have this dos command which will automatically scan ips in the given range .


FOR /L %i IN (42,1,46) DO ping -a 192.168.1.%i

it runs ok from command prompt,but when i try to run it from a batch file ,it gives an error w.r.t to varaible i.

can any one help me with creating a batch file