Recommend a batch process the most complete humanization tutorial 1th/3 page _dos/bat

Source: Internet
Author: User
Tags goto
This is a technical tutorial, I will use very simple words to express their meaning, you want you to 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 has no fixed format, as long as the following is OK: Each row can be treated as a command, each command can contain multiple note commands, 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, and few people can face the full screen of the code and calm 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):

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:

@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 Trojans used by the port, you can easily determine whether the race of the glacier. However, this is not certain, because the glacier default port 7626, can be modified completely. Here are just the methods and ideas. Here is the introduction of methods and ideas to make changes, you can check other Trojan script, and then change, add in parameters and port and Information list file, it becomes automatic detection of all Trojan script. Oh, is not very enjoyable? The script also uses the combo command && and Pipe command |, which is described in more detail later.

Example four, the batch processing automatically clears the system garbage, the script is as follows:

@echo off
If exist C:\windows\temp\*.* del c:\windows\temp\*.*
If exist C:\windows\tempor~1\*.* del c:\windows\tempor~1\*.*
If exist C:\windows\history\*.* del c:\windows\history\*.*
If exist C:\windows\recent\*.* del c:\windows\recent\*.*

Save the above script content to the Autoexec.bat, every time when the system garbage to automatically delete. Here need to pay attention to two points: first, DOS does not support long filename, so there is tempor~1 this dongdong, two, can be changed according to their actual situation, make it meet their own requirements.

How about, see here, do you have a bit of interest in batch processing scripts? Do you find yourself falling in love with this stuff? Don't be happy too early, love is not a simple thing, it may bring you happiness and happiness, of course, can make you painful to jump. If you know it's hard to go on, I'm you! Keep working hard, maybe in the end you don't have to get true love (it's really possible, loved ones know), but you can feel the whole process of love, that's all. Sour, bitter and spicy, there is no sweet God knows.

Why does the batch process have anything to do with love? It's not that I'm bored, it's not because it's funny how much, there are two reasons: one, batch processing and love have a lot of the same place, some places I use the "professional" jargon is not clear (I do not doubt their ability to express, but the matter itself is not clear), said = Did not say, But a metaphor of love known to all on Earth (what is Love?) How do I know!! , maybe you will be bright in your heart, with half the effort, why not? Second, my time is not very good, cold fever headache nasal congestion, but the main or emotionally devastated, engaged in the people bored, borrow a few words of the time to write a tutorial, we all when buy Dogskin plaster, completely can omit not to look (perhaps really a little effect----not let you look at the fall asleep, Knock your head off and come to me for reimbursement of medical expenses). Perhaps next time in the tutorial you will see Yang, Zhang Mowgli and other Jin Veteran's heroes.

After reading the first chapter of the friends, must have a preliminary impression of batch processing, know what it is used to do. But do you know where the essence of batch processing is? Actually very simple: the idea must be nimble! Nothing can not be done, only unexpected. This and love is a little different, because the world of love is two of people's world, wishful thinking does not call Love (added: that is called unrequited affection.) Nonsense! and batch processing is a person's heaven, you can do whatever you want, not up to the realm!

Batch processing looks messy, but it's logical, absolutely no less than other programming languages (such as compilations), if you write a script that is a mess, and although every line of command is correct, but from the beginning to the end, not necessarily get the result you want, perhaps a screen of bad command or fail name. This has something in common with love: Steps to run, missing or increased steps can lead to a result that you don't want to see. Fall in love with friends, I believe there is no doubt this sentence. My Love batch processing, the output result is not bad command or fail name, the screen shows: ' Your Love ' is not an internal or external command, nor a running program or batch file. Then the cursor keeps flashing, waiting for the next wrong input.

Starting from this chapter, we will introduce the common commands in batch processing, many common DOS commands have this extensive application in batch script, they are the body part of batch script, but batch processing is more flexible and more automation than DOS. To learn batch processing, DOS must have a relatively solid foundation. Here only some relatively less use (relatively) DOS commands, commonly used commands such as copy, dir, etc. do not introduce (these seemingly simple commands are actually complex, I am afraid I can not say clearly!) )。

Example five, look at an instance first. This is a very interesting script, a small and practical good dongdong, the batch processing "Automation" features reflected incisively and vividly. First introduce the origin of this script: we all know Assembler (MASM) of the machine process, first to the source code to compile, connect, and then execute, and there are many links between the need to enter a lot of things, the trouble is very (only experienced friends understand). How to make this process simple? When we compile the curriculum design, I "was forced" to write this script, use it very cool, hehe. Look at the script content:

Copy Code code as follows:

@echo off
:: Close Echo
Cls
:: Clean screen
echo this programme are to make the MASM programme automate
::d isplay Info
Echo Edit by codered
::d isplay Info
echo Mailto me:qqkiller*** @sina. com
::d isplay Info
If "%1" = "" Goto usage
:: If input without paramater goto usage
If '%1 ' = = '/? ' Goto usage
:: If Paramater is "/?" Goto usage
If '%1 ' = = ' help ' goto usage
:: If Paramater is ' help ' goto usage
Pause
::p ause to usage
MASM%1.asm
:: Assemble the. ASM Code
if errorlevel 1 pause & Edit%1.asm
:: If error pause to = Error msg and edit the code
Link%1.obj &%1
:: Else link the. obj file and execute the. exe file
: Usage
:: Set Usage
echo usage:this BAT file name [ASM file name]
echo Default BAT file name is START. BAT
::d isplay usage

Current 1/3 page 123 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.