This may seem trivial but I'm looking for the quickest method to determine my PC's IP address within my network.

  • This changes regularly as I connect from one network to the next via DHCP
  • The connection changes from wired to wireless
  • Windows 7 PC (although ideally the perfect solution would work on all versions of Windows)
  • Various adapters installed (e.g. VMWare, Tunnels, etc.)

I need to know this as I often run a local web server where I need to access files over the local network... and since it changes regularly I want the fastest method to retrieve the address.

My current flow is:

  1. WindowsKey + R to open the Run dialog
  2. "cmd" + Enter to open a command prompt
  3. "ipconfig" + Enter to get the diagnostics info
  4. Scroll to or resize the window so that I can see the line in my Ethernet adapter Local Area Connection for my ipv4 Address
  5. Remember it to type elsewhere... or
  6. Right click > select Mark > highlight the address > press Enter to copy it to the clipboard

This wasn't so bad with Windows XP when I had no additional adapters, tunnels, wireless connections etc. but the amount of data returned with this command makes it hard to pluck out.

Surely there must be a better, faster way! (bonus points if adding it to the clipboard is easily accomplished)

  • 2
    I usually use Start->Run: cmd /k "ipconfig | find "IPv4" | CLIP"
    – A T
    Commented Jan 26, 2012 at 1:50
  • 3
    Have you considered asking the network administrator for a a static IP assigned by DHCP? This would be a much better solution
    – Earlz
    Commented Jan 26, 2012 at 16:54
  • It would be helpful... but alas its many networks and I don't always have such options/permissions.
    – scunliffe
    Commented Jan 26, 2012 at 17:55
  • @AT, The /k would be optional isn't it?
    – Pacerier
    Commented Apr 22, 2015 at 6:13
  • Take a look at this app as well ipaddressinfinity.blogspot.com Commented May 25, 2016 at 11:03

15 Answers 15


Type this into a .bat file. You can then create a shortcut to it and place it in the taskbar, start menu, or assign a hotkey.

ipconfig | find "IPv4" | find /V "192.168." | CLIP

What it does: First find returns all the lines that contain IPv4. If you have multiple network adapters, from example from VMWare, you may want to exclude them. That's where find /V comes into play, it finds all lines that do not contain given string. For example, that's what I get after the first find:

>ipconfig | find "IPv4"
   IPv4 Address. . . . . . . . . . . :
   IPv4 Address. . . . . . . . . . . :
   IPv4 Address. . . . . . . . . . . :

Finally, CLIP copies the output to the clipboard, so you will be left with

>    IPv4 Address. . . . . . . . . . . :

If that's not enough maybe someone else can refine it with fancy search patterns.

  • This is the method I use, the key is in refining the search string for the particular circumstance. But once you have the batch file you are good to go.
    – Dennis
    Commented Jan 25, 2012 at 16:23
  • 4
    Do this and then set a shortcut key (like CTRL-SHIFT-I) to run it. Commented Jan 25, 2012 at 16:35
  • 1
    See my solution for a similar approach using AutoHotkey: superuser.com/a/382440/100787
    – iglvzx
    Commented Jan 26, 2012 at 2:36
  • 2
    It's unfortunate that this only works for networks with a 192.168.x.x subnet
    – Joren
    Commented Jan 26, 2012 at 13:31
  • 4
    +1 for the clip command, which I had somehow never heard of! Commented Jan 26, 2012 at 16:59

Create a shortcut to BGinfo (a program that shows system information on the Windows background). Double-click. : )


There seemed to be several solutions to this problem and I even came up with one of my own.

Similar to @iglvzx I too used the AutoHotKey utility to create my own utility app.

I've posted the app online here: http://dl.dropbox.com/u/177276/ipAddress.exe

I throw my exe into my Startup folder... and it sits quietly waiting until I hit the hotkey:

WindowsKey + I

which then brings up this dialog... allowing me to copy the address with a single click... or navigate to another window as the IP address will display on the app tab on the start bar. I ended up opting out of automatically putting it on the clipboard just in case I had something important on there that I didn't want to accidentally delete.

enter image description here

Here's the source code I used to get the IP address (it makes a presumption that the %A_IPAddress1% is the correct one (but from my testing it always was)):


Menu, tray, NoStandard
Menu, tray, add, Exit, ExitAppCompletely

Hotkey, #i, ShowIPAddress

Gui, Add, Text, x50 y8, Your IP Address:
Gui, Add, Edit, x140 y5 ReadOnly vIPAddress, %A_IPAddress1%
Gui, Add, Text, x50 y35 w250 vCopiedStatus,

Gui, Add, Button, x70 y65 w75, &Copy
Gui, Add, Button, x150 y65 w75, &Dismiss
Gui, Show, W290 H100 Center, %A_IPAddress1% - IP Address

clipboard = %A_IPAddress1%
GuiControl,, CopiedStatus, Copied %A_IPAddress1% to the clipboard
Sleep, 1000
GuiControl,, CopiedStatus,
Sleep, 500

Gui, Destroy

  • One-liner version with auto-hotkey: inputbox,ipaddr,IP Address,Your IP address is:,,,,,,,,%A_IPAddress1%
    – mrcrowl
    Commented Aug 29, 2016 at 20:48

Have you tried using a netbios hostname instead?

Figure out your computer name, and then try to ping it using that name on a different computer.
You may find you don't need the IP address at all.

You can get the hostname by running the command hostname on your machine.


I use www.whatismyip.org. Very simple to use, just navigate to the site in your favorite browser and it will display your external IP.

Like any text, just highlight and CTRL-C to copy.

If you set it as your homepage and put a shortcut in your QuickStart bar, it only takes 1 click and a copy to get your IP on the clipboard

  • 14
    it's better to use google directly, no need to visit an actual website. google.com/search?q=my+ip at the top Your public IP address is Commented Jan 25, 2012 at 19:26
  • 6
    This was specified: The OP asked for his PC IP.
    – kinokijuf
    Commented Jan 25, 2012 at 20:37
  • 5
    @Jeff Atwood - google is an "actual website" :)
    – warren
    Commented Jan 25, 2012 at 21:49
  • 3
    @warren no, Google is the start page for the internet Commented Jan 25, 2012 at 23:27
  • 2
    @JeffAtwood: How on earth would someone's public IP address ever be Worst example of a public IP ever.
    – Joren
    Commented Jan 26, 2012 at 13:33

This doesn't work on my XP box but on Windows 7 I can limit the info to a single adapter with

netsh interface IP show addresses "Local Area Connection" | findstr "IP" | clip

Which could go into a batch file


Just to expand on Amadeu's great answer, here's a variant of that that strips off the beginning part. (must be run as a batch file)


FOR /F "tokens=*" %%i in ('ipconfig ^| find "IPv4"') do SET result=%%i

echo %result:IPv4 Address. . . . . . . . . . . : =% | clip
C:\Documents and Settings\myusername> ipconfig /all | find "IP Address"
        IP Address. . . . . . . . . . . . :


C:\Users\dalvi>ipconfig /all | find "IPv4 Address"
        IPv4 Address. . . . . . . . . . . :
  1. [WindowsKey] IP
  2. [Enter] to open "View network connections"
  3. Double click on your network
  4. Click on "Details"

You can Ctrl+C inside, it will copy whole window content, including the IP addresses

There you go, with four keystrokes and three clicks :)


I've come up with a solution using AutoHotkey. Compile the script and then run the executable. Your IP address will be quickly copied to the clipboard! This takes the first address from the the output of ipconfig /all. If you need help customizing the script, just let me know. :)


http://ahk.igalvez.net/GetIPv4.exe, 784 KB, Windows 7

Clipboard =

myCommand = ipconfig /all | find "IPv4" | clip

Run cmd.exe
Send %myCommand%{Enter}
Sleep, 500
Send exit{Enter}

myString = %Clipboard%

StringReplace, myString, myString, %A_Space%, , All
StringReplace, myString, myString, IPv4Address...........:, , All
StringReplace, myString, myString, (Preferred), , All

StringSplit, myLines, myString, `r`n

Clipboard = %myLines1%

  • 1
    Wow! 2 minds think alike! I too figured that an AutoHotKey command would be an easy way to run this... (I'm going to post my code as well)
    – scunliffe
    Commented Jan 26, 2012 at 14:24
  • @iglvzx, I mean if I was going to download something anyway, why not download a proper tool that does the exact thing the question wanted?
    – Pacerier
    Commented Apr 22, 2015 at 6:16

While all the other options will work, if you need to get your IP address that often, I would have a dedicated program running just to deliver it to you. For instance, I use a desktop gadget that displays my IP address.

This one, for instance, will display your IP address: http://pcsupport.about.com/od/toolsofthetrade/gr/system-monitor-gadget.htm

I also know there has to be a program somewhere that will sit in your system tray and feed you your ip address whenever you click on it.

Or maybe you could use a firefox/chrome extension.
Hundreds of ways this could be done. Just use your imagination.


This doesn't get your IP address but does solve your underlying problem:

Install Apple Bonjour for Windows on the machines you use, and you can reach the websites on them as http://[machinename].local/. Apple Bonjour uses the ZeroConf networking standards to resolve hosts in the .local domain without any kind of central server. It's built in to Mac OS, and there is a linux implementation included in most distros called Avahi.

It even works over the 169.254.x.x link local IP addresses you get that usually mean your computer has failed to get an IP address with just a crossover cable between two machines.

I use it to allow windows-equipped colleagues to access test web sites hosted on my MacBook.

  • Install a full program (bloatware, with services that will autostart at every boot) on every machine? How can this be a good answer for the problem here? Commented Jan 26, 2012 at 13:19
  • @dema80 zeroconf is a very useful service. It solves this problem and many others.
    – rjmunro
    Commented Jan 26, 2012 at 15:07

If you're cool, you'll keep a PowerShell window handy at all times. Then you can just run this script: http://pshscripts.blogspot.com/2009/01/get-ipaddressps1.html


Install realvnc on your pc, hover your mouse over the task bar notification.

RealVNC provides remote control software which lets you see and interact with desktop applications across any network.


If you use JPSoft's TakeCommand (TCMD.exe) Command-line, there's an automatic variable:


Be careful, though: It is a space-delimited list of every IP address.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .