Computing.Net > Forums > Disk Operating System > IP as variable (Win98 and up)

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.

IP as variable (Win98 and up)

Reply to Message Icon

Name: Rebel
Date: August 13, 2003 at 07:25:52 Pacific
OS: 98, 2K, and XP
CPU/Ram: Pentium
Comment:

I would like to set my ip address as a variable and parse out the first 3 digits ex. if my ip address is 10.1.7.38, I only want to look at 10.1. Based on this, I can determine the pc's location in our subnet. I've found a way to do this in 2K and XP but the same batch file does not work in 98. Here's the batch file:
>
FOR /F "TOKENS=2* DELIMS=:" %%A IN ('IPCONFIG /ALL ^| FIND "IP Address"') DO FOR %%B IN (%%A) DO SET FULLIPADDR=%%B
SET IPADDR=%FULLIPADDR:~0,4%
IF '%IPADDR%'=='10.1' GOTO WC
IF '%IPADDR%'=='10.2' GOTO Troy
>
Does anyone have an idea on how to get this result in Windows 98, 2K and XP?




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: IP as variable (Win98 and up)

IP as variable www.computing.net/answers/dos/ip-as-variable/13624.html

dos 7.00 and up www.computing.net/answers/dos/dos-700-and-up/5459.html

Change IP address www.computing.net/answers/dos/change-ip-address/13723.html