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