I can run “ipconfig” in a Windows Command Prompt on my desktop, but
if I run it on my laptop I get: “‘ipconfig’ is not recognized as an
internal or external command, operable program or batch file.”
What do I do?
ipconfig is a standard Windows utility and should be part of your
installation by default. Obviously, for some reason it’s not.
We’ll look at a few ways to see if you have it, where it might be,
where else it might be, and how to get it where it should be.
Become a Patron of Ask Leo! and go ad-free!
I’ll use “ipconfig.exe” as an example, but in reality this applies
to almost any file that’s a part of Windows.
The first thing we’ll attempt is to search for the file on your hard
disk. Again, in the Command Prompt:
C:\>dir ipconfig.exe /S
The “cd” command changes the current directory or
folder. Normally when you open a command prompt, the current directory
is the directory associated with your user account. We’ll want to
search the entire hard disk, which means we want to be at the top level
directory to do that search. That directory is referred to as
“\“, so “cd \” takes us there. You can see that
reflected in the prompt that results on the next line, as it shows you
the current directory.
the file on your hard disk.”
The “dir” command produces a listing of files, or a
“directory”. We ask it to show a list of all files named
“ipconfig.exe”, and the “/S” parameter says “search the current folder
and all folders within it”. When executed at the top level directory
“dir /S” scans the entire hard drive.
On my system that results in:
Volume in drive C is NOTENQUAD Volume Serial Number is E852-AA62 Directory of C:\WINDOWS\$NtServicePackUninstall$ 07/27/2007 04:00 AM 55,808 ipconfig.exe 1 File(s) 55,808 bytes Directory of C:\WINDOWS\ServicePackFiles\i386 04/14/2008 05:42 AM 55,808 ipconfig.exe 1 File(s) 55,808 bytes Directory of C:\WINDOWS\system32 04/14/2008 05:42 AM 55,808 ipconfig.exe 1 File(s) 55,808 bytes Total Files Listed: 3 File(s) 167,424 bytes 0 Dir(s) 176,697,344,000 bytes free
As you can see, ipconfig.exe is in several places, including
“C:\WINDOWS\system32”, where it’s supposed to be. In your case it’s
apparently not there.
The other places you might find it include:
- C:\WINDOWS\ServicePackFiles\i386 this would
typically be the most recently applied service pack, and hence a fairly
reasonably up-to-date copy of the file. This is probably the copy that
I would choose to use below.
- C:\WINDOWS\$NtServicePackUninstall$ this is the
previous version of the file prior to that service pack. This is
retained so that you can uninstall the service pack and revert to the
previous version of this, and all files affected by the service
- C:\I386 not listed in my example, since I have
installation CDs, but many manufacturers will place a copy of the
Windows install files in this folder in lieu of (or occasionally in
addition to) giving you an install CD. This would be the version of the
file as originally installed on your machine. Be sure to see the note
below about compressed files.
- D:\Windows\System32 I include this specifically
because many manufacturer’s often include a copy of your Windows
installation on a recovery partition. On my laptop that happened to be
the “D:” drive. If you don’t find what you’re looking for on your
primary Windows drive, and you have a separate recovery partition, it’s
worth searching that as well.
Regardless of which one you choose, you can simply copy the file to
where it was supposed to be (C:\Windows\system32, for example), or to
some other appropriate place where you can use it. Depending on the
file it may, or may not be safe to use it in the place that you found
it, so I recommend making a copy so as not to inadvertently damage the
contents of that location.
If you don’t find the file, you’ll need to grab your Windows
installation CD or DVD. Much like the “C:\I386” example above, that
vast majority of Windows files are in a folder “\I386” on the
installation CD, and you can just copy them directly from the CD to
where they belong in your existing Windows installation.
If you don’t have an installation CD, and all you’re attempting to
do is replace a missing file or files on your legitimate and legal
installation of Windows, it’s seems to me that it’d be perfectly valid
to go out and borrow an installation CD from which to copy the files.
Be sure that it’s the same version of Windows – it may not matter for
some files (like ipconfig.exe), but for others it’s actually quite
critical that the Windows version match.
Compressed Files: on installation media and copies
of installation media individual files are often compressed to save
space, and you’ll need to decompress them before they can be used.
Compressed files also have a modified name – the last character of the
extension is replaced with an underscore. That means that instead of
searching for “ipconfig.exe” in our example, we would
look for “ipconfig.ex_“.
Once you’ve located “ipconfig.ex_” you’ll need to decompress it:
What I’ve done with the command above is used the
expand command to decompress ipconfig.ex_ into
ipconfig.exe, placing the later in a temporary folder on my hard drive.
“F:” is my CD drive with the Windows installation CD installed, and the
compressed file was located in the I386 folder.
The results look like this:
Microsoft (R) File Expansion Utility Version 5.1.2600.0 Copyright (C) Microsoft Corp 1990-1999. All rights reserved. Expanding ipconfig.ex_ to c:\t\ipconfig.exe. ipconfig.ex_: 17105 bytes expanded to 49664 bytes, 190% increase.
The bottom line is that missing Windows files may be found in
several locations, both on your hard disk and on your original
installation media. Be sure to look for compressed versions as well,
which can then be easily decompressed before use.