Batch Processing of Port Link count statistics in Windows

Source: Internet
Author: User

In Windows, the batch processing of Port Link count statistics is semi-Original. It refers to a batch processing of windows directory and file count statistics from Baidu Library, it is currently used in online systems and called using vbs script files. The statistical function is normal. Www.2cto.com @ Echo off set/a = 0 netstat-an | find/I "port"> list file storage path for/f "delims =" % a in ('Type list file Storage path ') do set/a + = 1 @ Echo on echo "% date % time % ---- % a %" <nul> the Save path of the statistics file is briefly described here: set/a = 0 defines a variable and assigns a value to the variable here. If no value is assigned to the variable here, the problem of accumulating multiple times will occur in subsequent statistics; netstat-an | find/I "port" is used to find the corresponding port in the output information of the netstat command and redirect the information to a file, to facilitate the subsequent use of the "delims =" command is the command to set the windows cut string cutting point. For example, if a string is asadafag, use the post-word "delims = a" command. After the string is output, it becomes s d f g, just like-F in awk; for xx % a in ('xx ') do xx is the for loop in the batch processing; @ Echo off/on is the screen output that enables and disables echo, because the batch processing will directly output the value assignment result when assigning values to variables, therefore, you can disable screen output when assigning values, but you still need to enable it to save the results later.

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.