Advertisement

06.18.2008 at 01:45PM PDT, ID: 23496829
[x]
Attachment Details

How do I parse the octets of an IP address into environment variables on a batch file?

Asked by amendala in Windows XP Operating System, Microsoft Windows Operating Systems, Microsoft Server

Tags: , ,

Greetings -

Does anyone know of a way to parse the octets of an IP address into environment variables in DOS?  There has to be some trick using loops or something to do this.  I would think... :)

What I would like to do is parse the first three octets into one environment variable and just ignore the final octet.

So if I had an IP address if 192.168.100.1, I would like to create an environment variable named %MYIP% and have it contain "192.168.100".

Is this doable?  Thanks in advance...

P.S.  If it would be easier to parse each octet into its own variable such as %OCTET1%, %OCTET2%, etc... I could use that too.  But I'd prefer to have the first three octets in one variable if possible.Start Free Trial
 
Keywords: How do I parse the octets of an IP addr…
 
Loading Advertisement...
 
[+][-]06.18.2008 at 03:03PM PDT, ID: 21817700

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 03:05PM PDT, ID: 21817710

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.19.2008 at 07:47AM PDT, ID: 21822656

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.19.2008 at 09:08AM PDT, ID: 21823641

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Windows XP Operating System, Microsoft Windows Operating Systems, Microsoft Server
Tags: Microsoft, Windows, XP Professional
Sign Up Now!
Solution Provided By: amendala
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628