1

I'm trying to create a very simple batch file that would run ipconfig and display the output, and then pause so I can see my machine's ip address on the local network.

Here's the code :

ipconfig

Pretty simple right? Yet it doesn't work, the script starts an infinite loop : enter image description here

Adding a pause command at the end of the script doesn't change anything. What am I missing?

Mickäel A.
  • 9,012
  • 5
  • 54
  • 71
  • Can you share the file extension used ? I have created a file `test.bat` and added code `ipconfig pause` and it is showing details only once and not going into infinite loop. – stud3nt Dec 04 '19 at 09:04

1 Answers1

7

The reason it's entering infinite loop is most likely you named the batch file as "ipconfig.bat" as well.

When executing "ipconfig.bat" which has contents

ipconfig

Windows is finding the same batch file (being in the same location and be given more preference than the system command) and executing the same batch file again and causing an endless recursion. Change the batch file name to something other than "ipconfig.bat"

Wander3r
  • 1,801
  • 17
  • 27