Batch processing of statistics port links under Windows

Source: Internet
Author: User

This batch of processing is a half original bar, which borrowed from the Baidu library inside a statistic of Windows directory and file number of batch processing, has been online on the system, using the VBS script file to invoke, statistical function is normal.

@Echo off

set/a a=0

Netstat-an | find/i "Port" > list File Save path

for/f "delims="%%a in (' Type list file save path ') do set/a a+=1

@Echo on

echo "%date%%time%----%a%"

Here is a brief explanation:

set/a a=0 defines a variable and assigns the variable here, if the variable is not assigned here, there will be a number of cumulative problems in the following statistics;

Netstat-an | The role of find/i "Port" is to locate the corresponding port in the information of the netstat command output and redirect the information to a file for easy use later

The "delims=" command is a command to set the cutting point of a Windows cutting string, such as a string that is Asadafag, then the string is then outputted with the Delims=a command, which becomes the S D F G, as in awk.

For xx%%a in (' xx ') doing xx this is the batch process inside for loop;

@Echo off/on is the screen output that turns on and off Echo, because the batch process outputs the assignment results directly when assigning a value to the variable, so you can turn off the screen output when you assign it, but you want to open it later, in order to save the results.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.