Batch file escape sequences

September 28, 2010 at 19:19:16
Specs: Windows 7, Intel Core i7-720QM
I am running the NETSTAT command (netstat -b 5 to be specific) in a batch file. The problem is that I need to end the command after a specific amount of time and I don't know how.

See More: Batch file escape sequences

Report •

September 29, 2010 at 14:31:50
Hi ntdave71694,

If the command does "hang" or it does take too long, and you dont want to wait..

Press CTRL + C and it will escape 'ASAP'.


"Don't put a question here." STFU :)

Report •

September 29, 2010 at 22:11:43
I already know about the Ctrl+C escape command. I need the batch file to do this for me though after a specific amount of time. Thanks for the help though!

Report •

September 30, 2010 at 21:19:33
I think the answer here would be to remove the interval parameter and run netstat in a loop.

If timer accuracy is important using a language that supports "time > xx"(or some form of int representation) conditionals or write your own/find an implementation of the same for batch (my guess would be ~100 lines for the logic).

if accuracy isn't particularly important looping "netstat -b" x times with a delay between would be fairly trivial to implement.

Report •

Related Solutions

October 2, 2010 at 14:46:09
Thanks! ++

Report •

Ask Question