Batch Process Classic Introductory tutorials! (never know the Master) 1th 5 page _dos/bat

Source: Internet
Author: User

Cloud Habitat Community added: batch processing is relatively simple language, we can write more to see other people's examples to learn, do not understand Baidu.

This is a technical tutorial, sincerely will use very simple words to express their meaning, as long as you can read and understand, you can learn knowledge. The purpose of this tutorial is to let every friend who has read these words remember a word: if love can make things easier, then let it be easy! The way to see this tutorial is slow! Slowly, as a product of a woman, a cup of tea, you will find many before in front of things suddenly become very distant, and some very distant things but suddenly returned to the front.

Let's outline what the batch process is. The definition of batch processing, so far I have not been able to give a suitable----many experts have not given----anyway, I do not know----look at me is not necessarily convinced----I am a rookie, not to mention, of course, but I would like to sum up a "more appropriate", and I also believe that I can explain it very clearly , let more rookie all know this is what dongdong, you use this dongdong can do what thing. Perhaps you will because of this article and "Unconditional love batch", then my goal is reached----I just want to let you love it, I just so drag, what can you do?? Really, love sometimes so drag, is so no reason, is so don't face! It's true!

In my understanding, the nature of batch processing is a set of DOS commands that are arranged in a certain order.

Ok,never Claver and get to business (gossip less about it). Batch, also known as batch script, is translated in English to batch, batch file suffix bat to take the first three letters. Its composition is not in a fixed format, as long as the following is OK: Each line can be treated as a command, each command
Can contain more than one note command, starting from the first line, until the end of the last line, it runs the platform is DOS. Batch processing has a very distinct characteristics: easy to use, flexible, powerful, high degree of automation. I do not want to write my own tutorial boring, because 牵缠 to the code (batch content is code?) )
The problem is boring, few people can face the full screen of code and quiet down. So I will use a lot of simple and practical examples to read this tutorial friends to experience batch processing that the radiant charm, feel it that ancient spirit of the character, unconsciously fell in love with batch processing (halo, How is Love?) What does a batch deal have to do with love? Answer: No! )。 Again "gossip": To learn batch processing, DOS basic must be in prison! Of course, brain flexibility is also a very important aspect.

Example one, first give a most easy batch script let everyone and it face familiar with it, the following lines of command to save as Name.bat and then execute (in the next article only give code, save and execute similar):

Copy Code code as follows:

Ping sz.tencent.com > A.txt
Ping sz1.tencent.com >> a.txt
Ping sz2.tencent.com >> a.txt
Ping sz3.tencent.com >> a.txt
Ping sz4.tencent.com >> a.txt
Ping sz5.tencent.com >> a.txt
Ping sz6.tencent.com >> a.txt
Ping sz7.tencent.com >> a.txt
Exit


Is it possible to read? Is it easy? But its role is very practical, the implementation of this batch, you can build a current disk called A.txt file, it records information can help you quickly find the fastest QQ server, so far away from the "Relay from the server" that painful process. Here > means to put the things in the previous command to the place given in the,>>, and the same as >, the difference is to append the results to the previous line of the results of the result, specifically the next line, and the previous line of command results will be retained, This will make the A.txt file bigger and larger (think about how to sabotage it??) )。 By the way, this batch can also be combined with other commands, make it completely automated to determine the speed of the server, the implementation of direct display of the fastest server IP, is not very cool? It will be described in more detail later.

Second, give an example of an outdated case (A.bat):

@echo off
If exist C:\progra~1\tencent\ad\*.gif del c:\progra~1\tencent\ad\*.gif
A.bat

Why is this an outdated example? Very simple, because now almost no one with advertising qq (KAO, my QQ also show friends measurements!!) ), so it's almost useless. But once its role is not small peep: Delete qq ads, let the dialog box clean. The address used here is the default installation address of QQ, the default batch file name is A.bat, you can of course modify according to the circumstances. The IF command is used in this script, so that it can be timely to determine and delete the effect of advertising pictures, you need to not close the command after the implementation of the DOS window, do not press CTRL + C forced to terminate the command, it has been monitoring whether there are advertising pictures (QQ also constantly check their ads are deleted). Of course this script takes up a little memory of you, hehe.
For example, use batch script to find out whether a middle glacier. The script reads as follows:
Copy Code code as follows:

@echo off
NETSTAT-A-n > A.txt
Type A.txt | Find "7626" && echo "congratulations! You have infected glacier! "
Del a.txt
Pause & Exit


Here, using the netstat command, check all the network port status, only you know the common Trojan used by the port, it is easy to determine whether
The human race is a glacier. However, this is not certain, because the glacier default port 7626, can be modified completely. Here are just the methods and ideas. Here to introduce
Is the method and the idea slightly changes, becomes may check other Trojan's script, again changes, adds in the parameter and the port and the information list file, changes
into a script that automatically detects all Trojans. Oh, is not very enjoyable? The script also uses the combo command && and Pipe command |, which is described in more detail later.

Current 1/5 page 12345 Next read the full text

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.