2

I tried running ipconfig from CMD, both elevated and not, but instead of displaying it's output inline, it opens another CMD and closes it immediately after the output is listed. I've tried running cmd /k from the cmd but the result is the same. I ran ipconfig on this machine just yesterday with no adventures. Please help me understand this.

4
  • Have it tried it as "cmd /k ipconfig" ? rather then just cmd /k – Wessel Apr 20 '15 at 12:02
  • yes, that is exactly what I meant by "tried cmd /k". I ran "cmd /k ipconfig" – Metaphor Apr 20 '15 at 13:12
  • Do you already have a command window open? If so, you don't need to add 'cmd.exe' before the command. Specifying cmd.exe before a command is explicitly stating to open a new command window to perform a command. – FoxDeploy Apr 20 '15 at 19:30
  • It sounds like @Metaphor was only running cmd /k as an unsuccessful troubleshooting attempt to keep the cmd window open after it terminated. – GuitarPicker Apr 20 '15 at 19:48
3

Run where ipconfig to see what is actually running. The correct ipconfig.exe is usually in the System32 folder. If it is running some other command, then the path may be different.

Example:

C:\>where ipconfig
C:\Windows\System32\ipconfig.exe

If someone created something else earlier in the path named ipconfig, it may be that program is running instead. Search your drive for ipconfig.* to see if there is a duplicate named command. It may end in .exe, .com, .bat, .cmd .

It is also possible that some sort of malware has replaced your ipconfig with something else, so you might want to scan well and check your ipconfig.exe against the official version for your edition of Windows.

2

Sounds like you're running cmd /c instead of /K. /c will close the window when your command or script finishes running, while /K will keep it open.

If I had to guess, you're using Winkey+R to run this cmd and auto fill is selecting the /c variant of your command, instead of the desired command.

The other possibility is that you might be running just ipconfig instead of cmd /K ipconfig.


Update: after rereading your question, I think I understand what is happening here: if you've already got a command window open, you do not need to specify cmd.exe before a new command.

If you are within a command window and run cmd ipconfig you're explicitly telling cmd.exe to "please open a new command window and run this command for me". Since your goal is to display the IP configuration within the current window, you simply need to run ipconfig from within your command window. If I'm missing something here about your scenario, please reply and I'll do my best to help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.