I'm trying to write a batch file that does a few simple(?) things. My fundamental goal is to open a command window, perform a netstat command, then use PAUSE to wait for any key, then run the netstat command again in the same command window. Repeatedly, until I close the window.
When I just used Netstat, the command window self-terminated, so I found
cmd /k netstat would keep it open. But that doesn't help, because it only runs once.
So I tried a loop, and so far my syntax has been unsuccessful, I think because I need to use the cmd /k the first time, and a plain netstat command the second time... but I can't figure out how to get the batch file to insert additional netstat commands in the same command window.
Something like:
cmd /k netstat
PAUSE
:numbers
netstat
PAUSE
goto :numbers
but again, the subsequent netstat commands don't show when I hit a key and the command window is active.
Also, I'm not at that point yet, but I'm hoping this will remain linked to the command window; I will be bouncing to another program to perform activities, then will want to continually bounce back to the command window to check the IP address list.
Can anyone give a hand?
Thanks!
When I just used Netstat, the command window self-terminated, so I found
cmd /k netstat would keep it open. But that doesn't help, because it only runs once.
So I tried a loop, and so far my syntax has been unsuccessful, I think because I need to use the cmd /k the first time, and a plain netstat command the second time... but I can't figure out how to get the batch file to insert additional netstat commands in the same command window.
Something like:
cmd /k netstat
PAUSE
:numbers
netstat
PAUSE
goto :numbers
but again, the subsequent netstat commands don't show when I hit a key and the command window is active.
Also, I'm not at that point yet, but I'm hoping this will remain linked to the command window; I will be bouncing to another program to perform activities, then will want to continually bounce back to the command window to check the IP address list.
Can anyone give a hand?
Thanks!