LWG said:
What I am trying to do is scan the ip address of the computer to
basically tell the batch file where the client is located so I can map
another drive. If it is one of the mentioned networks (10.29.11.0,
10.29.12.0, 10.29.13.0, 10.29.14.0) I want to do something different
(just map another drive). That is where all of this started (in my
mind). I am an amatuer at this (obviously) and want to make sense of
each % and command. I am slow, and I do appreciate your help...
Hmm, we'll try ,-)
==========sample output of german ipconfig =============
C:\>ipconfig
Windows 2000-IP-Konfiguration
Ethernetadapter "WLan":
Verbindungsspezifisches DNS-Suffix:
IP-Adresse. . . . . . . . . . . . : 192.168.3.246
Subnetzmaske. . . . . . . . . . . : 255.255.255.0
Standardgateway . . . . . . . . . : 192.168.3.254
==========sample output of german ipconfig =============
In my example I use IP-Adresse as findstring you have to
adapt it to the exact writing in your version.
=============GetIP.Cmd=======================
@echo off & setlocal enableextensions
for /F "tokens=2 delims=:" %%A in ('findstr "IP-Adresse" %windir%\addr.dat') DO set ipaddr=%%A
:: This line fills ipaddr with all text after the colon
:: in the above line IP-Adresse " 192.168.3.246"
:: To extract the relevant parts use statements like
:: the following offset(from 0), length
Echo Firstpart: %ipaddr:~1,3% gives 192
Echo Secndpart: %ipaddr:~5,3% gives 168
Echo Thirdpart: %ipaddr:~9,1% gives 3
Echo Lastpart : %ipaddr:~11,3% gives 246
=============================================
You should be able to adapt this example for your needs. Instead of
echoing you can build a new value for comparisons etc.
Help on the used commands whith
for /?
findstr /?
set /?
hth
Matthias