A Cleaner Display of Your IP in Windows
Last Update: Jul 11, 2021

AI changed software development. This is how the pros use it.
Written for working developers, Coding with AI goes beyond hype to show how AI fits into real production workflows. Learn how to integrate AI into Python projects, avoid hallucinations, refactor safely, generate tests and docs, and reclaim hours of development time—using techniques tested in real-world projects.
If you’re like me, you constantly need your IP in Windows. When working with network interfaces and multiple servers, I find myself checking my IP a lot.
I built a little utility for myself that only shows the IP addresses on the host, rather than typing ipconfig and getting a long list, I can simply type “ip” and it will only show IP addresses.
C++ Version of the Tool
The following compiles with GCC for Windows, and probably a lot of other compilers as well. This utility is standalone and only needs to be copied into a folder within your path.
Create a file called ip.cpp and add the following:
#include <iostream>
#include <stdio.h>
#include <typeinfo>
using namespace std;
int main()
{
FILE *dir;
char direntry[80];
dir = popen("ipconfig", "r");
while (!feof(dir)) {
fgets(direntry, sizeof(direntry), dir);
string output = direntry;
if ((output.find("IP") != string::npos)) {
cout << direntry << "\n";
}
}
return 0;
}
This simple executable will cut down your time by only showing the information you need at the time. I hope this helps someone.
C# Version of the Tool
I have also created a C# version of this tool, but it requires the .NET framework to be installed. Create a file called IP.cs with the following code:
using System;
namespace iptools
{
class ip
{
static void Main(string[] args)
{
//Create process
System.Diagnostics.Process pProcess = new System.Diagnostics.Process();
//the command we want to run
pProcess.StartInfo.FileName = "ipconfig";
// we don't want this to output the original command
pProcess.StartInfo.UseShellExecute = false;
//Set output of program to be written to process output stream
pProcess.StartInfo.RedirectStandardOutput = true;
//Start the process
pProcess.Start();
//Get program output
string strOutput = pProcess.StandardOutput.ReadToEnd();
// split it by line
string[] ourText = strOutput.Split('\n');
Console.WriteLine("\n\n");
foreach (string line in ourText)
{
if (line.Contains("IP"))
{
Console.WriteLine(line + "\n");
}
}
// close the process
pProcess.Close();
}
}
}
Compile this file from the command line:
csc ip.cs
and it’s ready!
Summary
These files both provide a simple executable to output your ip address where you can read it quickly. If you have multiple adapters they will show up as well.
I hope this helps!
If you’d like to learn more, here’s a great C++ fundamentals course.
Advanced C++ developers wanting to level up should check out High-performance computing in C++

Skip the hype. The newsletter that keeps you in the know.
AI news curated for engineers. The AI New Hotness Newsletter is what you need.
Zero fluff. Just the research, tools, and infra updates that actually affect your production stack.
Stay up to date on AI for developers - Subscribe on LinkedIn





