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

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.

Batch file help.

Reply to Message Icon

Name: Kevin M
Date: October 3, 2003 at 14:10:15 Pacific
OS: Windows XP
CPU/Ram: AMD 2300+ 1GB DRR
Comment:

I created a simple batch file to lookup physical addresses on our network and store them to a file.

You have to manually enter the IP, but I'd like to have the batch file do the searches from a file, so I do not have to enter each one.

Here is my current batch file.

@ECHO OFF
CLS
:LOOP
SET IP=
SET /P IP=Type the IP and press Enter:
IF NOT '%IP%'=='' SET IP=%IP:~0,15%
ping -n 1 %IP% |find "Packets:"
arp -a |find "%IP%" >> Out.txt
GOTO Loop
:End

Thanks for the help ahead of time.




Sponsored Link
Ads by Google

Response Number 1
Name: borelli35
Date: October 5, 2003 at 05:51:56 Pacific
Reply:

==================================================
I'm not sure about the batch file actually reading a file but an alternative is to pipe an already typed file as input to the batch program. Type in the keys and ip-address numbers and periods that you would normally have to do (this must be in the exact order that the file is expecting the input for). Once you have the input worked out call the first batch file with another batch file that contains only the following line:

batch1.bat < input_filename.inp

This will automatically provide the predetermined input from input_filename.inp (what every name you choose for the piped input file). This can be a bit tricky at first but once it's ironed out it works well.

borelli35


0
Reply to Message Icon

Related Posts

See More







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: Batch file help.

batch file help www.computing.net/answers/programming/batch-file-help/13830.html

Batch File Help www.computing.net/answers/programming/batch-file-help-/11464.html

batch file help www.computing.net/answers/programming/batch-file-help/190.html