Computing.Net > Forums > Disk Operating System > Cabling Issues

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.

Cabling Issues

Reply to Message Icon

Name: Chris
Date: December 17, 2002 at 20:43:31 Pacific
OS: Win2k
CPU/Ram: na
Comment:

I have the role of Network Administrator thrust on me at work, a nightclub. All the POS (point of sale) machines run on WinNT4 (don't ask me why) and the server and office machines are Win2k Adv Serv (don't ask me why the office machines are servers :| ).
Anyhoos, we are getting a few new servers so that we in actuality have separate networks on each floor of the nightclub. However, all the network cable is jumbled together and plugged into 1 Ethernet Switch.

Now it's my task to figure out which wire goes to which machine.

To do this, I've switched the network of only 21 machines to use static ip addressing instead of DHCP.

Now I'd like to create a small batch file that tries to ping each ip address and appends to a report.txt, so I can determine which IP ADDRESS is no longer responding after I unplug 1 cable and run the script.

However, instead of just creating 1 long boring .bat file (which unfortunately I have, and does work) I'd like to be kinda clever and use an IF structure and some GOTOs along with some sort of counter VARIABLE and 2 VARIABLES... 1 for the Machine Name and 1 for the Machine's IP Address. So basically all I have to do is assign the variables for Machine IP and Name and Counter, then using an IF structure use a GOTO... then change the value of the 3 variables, the use a goto... so that in effect my code that actually does the PINGING and APPENDING to report.txt is in one spot and not repeated ad infinitum.

However, my problem lies in the IF statement (or perhaps my variables). Can someone plz lend some advice to this complete novice :)

Here's a smidgen of my code (testing web-based ip's as I'm currently at home and not at work, once the technical side is known, I can apply it at work :) ):


@ECHO off
SET counter = 3

:BLUESNEWS
CLS
PING www.bluesnews.com
PAUSE
SET counter = 2
GOTO BEGIN

:FILEPLANET
CLS
PING www.fileplanet.com
PAUSE
SET counter = 1
GOTO BEGIN

:BEGIN
IF "%%counter%"=="3" GOTO BLUESNEWS ELSE
IF %%counter% == "2" GOTO FILEPLANET ELSE
IF %%counter% == "1" GOTO END ELSE

:END
::CLS
::ECHO Finish!!!
PAUSE



Sponsored Link
Ads by Google

Response Number 1
Name: Elric
Date: December 18, 2002 at 04:22:37 Pacific
Reply:

G'day,

Not totally sure, but I don't think you can make backward jumps in batch files. All goto references must be forward.
I think that will probably just fall straight to the end after the first test..
I think you can use the call command with other batch files, but I'm not 100% on how you would do it.
Why don't you try QBasic?? or even the Windows Scripting Language. Batch file programming gets extremely cryptic after a few lines.

Good luck,

Elric


0

Response Number 2
Name: Neorush
Date: December 18, 2002 at 07:44:24 Pacific
Reply:

I would read all the ip's in from a file and then output to another file would only require 1 line of code in a batch file and look like this:
FOR /F " tokens=1 " %%i in (CPULIST.TXT) do ping %%i -n 1 >> report.txt

cpulist.txt would read:
111.11.11.111
111.11.11.112
..and so on it will ping each IP listed and output the results to report.txt I set the count "-n 1" equal to one. you can put it as high as you want...this is just the number of times the machine is pinged. hope this helps.


0

Response Number 3
Name: Chris
Date: December 18, 2002 at 10:10:00 Pacific
Reply:

My thanks !!!!

:-)


0

Sponsored Link
Ads by Google
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 Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Cabling Issues

floppy drive errors www.computing.net/answers/dos/floppy-drive-errors/14463.html

serial cable link software www.computing.net/answers/dos/serial-cable-link-software/6591.html

Null MOdem cable www.computing.net/answers/dos/null-modem-cable/12206.html