Computing.Net > Forums > Programming > help .bat file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

help .bat file

Reply to Message Icon

Name: gorf
Date: August 22, 2003 at 12:04:51 Pacific
OS: winxp
CPU/Ram: 2600 1gb
Comment:

i would like to make a loop in a .bat file
if thers a way i got one but theres to meny numbers 1- 255
ex;

FOR %%1 IN (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17) do ping -n 1 192.168.1.%%1

this one works but i would have to type all 1-255 is there a why to make a counter 1-255? then loop it ?

thx -gorf



Sponsored Link
Ads by Google

Response Number 1
Name: Chi Happens
Date: August 22, 2003 at 13:35:49 Pacific
Reply:

gorf,
please excuse my ignorance, and I don't mean to sound like an ass...but why are there so amny .bat postings?

Do people really still use .bat files?

I'm really curious. And as far as looping, I think that you can loop in bat files, but I really don't remember the syntax. Might be helpful to do a goolge search on DOS or batch files.

Chi Happens


0

Response Number 2
Name: zeroguy
Date: August 22, 2003 at 19:00:03 Pacific
Reply:

Yeah, actually, I think they do, Chi. Batch files are like the DOS equivelant of *nix scripting (at least in my mind). Do people still use scripts?

Of course, there's far fewer who use batch files becuase fewer know an extensive amount of DOS commands. Most of the people that would know how are nix users. ;)


0

Response Number 3
Name: egkenny
Date: August 22, 2003 at 20:07:50 Pacific
Reply:

This will loop from 1 to 255

for /L %%N in (1,1,255) do ping -n 1 192.168.1.%%N


0

Response Number 4
Name: egkenny
Date: August 22, 2003 at 20:39:19 Pacific
Reply:

Here is a reference fot the batch FOR command in Windows 2000/XP:
http://www.labmice.net/articles/batchcmds.htm


0

Response Number 5
Name: Chi Happens
Date: August 22, 2003 at 21:53:58 Pacific
Reply:

wow, i didn't know they still used batch files. I guess I never realized how much they are/were used. I have always written applications (DOS/Windows) to do stuff...I guess I never knew how much you could do in bat files.


0

Related Posts

See More



Response Number 6
Name: gorf
Date: August 22, 2003 at 22:59:08 Pacific
Reply:

thx you all
____________________
./bin/windows_sucks/


0

Response Number 7
Name: Infinite Recursion
Date: August 23, 2003 at 17:10:05 Pacific
Reply:

Glad you got this working Gorf...

Just to put my two cents in about the "do people still use Batch files" comment...

Yes, I use them all the time to administer my Apache web servers and to interact with my C++ programs. I completely agree with Zeroguy... "Batch files are like the DOS equivelant of *nix scripting". I have always liked the command line, I suppose thats the reason I took a liking to the Gentoo Linux platform and the *nix shells and consoles... and the reason I still drop to DOS when I want to manipulate files or other tasks of the day.

Infinite Recursion


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: help .bat file

Bat file to remove antivirus 2009 www.computing.net/answers/programming/bat-file-to-remove-antivirus-2009/17484.html

Bat File Help www.computing.net/answers/programming/bat-file-help-/9414.html

help makeing .bat files www.computing.net/answers/programming/help-makeing-bat-files/7571.html