This is a technical tutorial, and sincerely will use very simple words express clearly the meaning of their own, as long as you read will be able to read, you can learn. The purpose of writing this tutorial is to read the text of each Friends remember the word: If you love to make things easier, then it simple! reading this tutorial method is to slow! slowly, as the product of a woman, a cup of tea, you will find Many things in front before suddenly became very distant, and some things very far away but suddenly returned to the front ...
is the first overview of what the batch stuff. the definition of the batch, so far I have not ---- can give a suitable number of experts have also given no ---- --- read anyway, I do not know ---- I do not necessarily convinced that I was a rookie, of course, not to mention ; but I would like to sum up a Maybe you will, because this article and love, sometimes to such a drag, so no reason that is such a shame! really!
as I understand, the nature of the batch is a bunch of DOS commands to form a certain set of order .. < br> OK, never claver and get to business (nonsense and get down to business.) batch, also known as the batch script, translated into English BATCH, BAT batch file extension to take the first three letters. It constitutes no fixed format, as long as the subject to the following This has to ok: each line can be considered as a command, each command can be included in the multi-note command, started from the first line until the end of the last line, which runs the platform is DOS. batch has a very distinctive features: easy to use, flexible, powerful, high degree of automation. I do not want to write a tutorial boring, because Qianchan to the code (be the contents of the batch code, right?) problem has always been boring, and very few Some people can face a screen full of code and settle down. So I will use the example of many simple and practical friend to read this tutorial to experience the charm of a batch of that radiance, feel it was weird character, unconsciously in love with the batch (halo, how is love? in the end the batch, and love have anything to do? Answer: No!). and then say is also very important aspect.
case of a first given one of the most easy batch script so that everyone and it mixed a Lianshu, a few lines of the following commands and then save it as name.bat execution (after the paper only to the code, save and execute a similar way):
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 not able to read understand ? is not very easy? but its role is very practical, the implementation of this batch, you can in your current disk to create a file named a.txt, which recorded information which can help you quickly find the best rate QQ fast server, so far from the > the same, the difference is the result appended to the results of the previous row behind, specifically, is the next line, and the results of the previous command line will be retained, so you can make the a.txt file growing (think of how to sabotage the??). By the way, this batch can be combined with other orders, into an entirely automated to determine server speed of the East, after the implementation of direct indication of the fastest servers IP, is not so cool ? will detail later.
cases of two, and then give an example of outdated (a.bat):
@ echo off
if exist C: Progra ~ 1 Tencent AD * . gif del C: Progra ~ 1 Tencent AD *. gif
a.bat
Why do I say this is outdated examples? very simple, because almost no one now with a band of the QQ ads (KAO, my friend measurements also show that it QQ!!), so it is almost no access to the. but once its role is not small glimpse: Delete QQ ads, so the dialog box clean. Here used address is the address of the default installation of QQ, the default batch file name a.bat, of course you can modify the situation. In this script if the command used, so that it can achieve a timely assessment of the effect of pictures and delete ads, you just need not shut down after the DOS command window, do not press CTRL + C to force the termination order, it has to monitor whether there are advertising images (QQ also be constantly see their ads be removed). Of course, this script takes you a little bit of memory, Oh
Society batch! really want to learn it is easy!
This is a technical tutorial, and sincerely will use very simple words express clearly the meaning of their own, as long as you read will be able to read, you can learn knowledge. The purpose of writing this tutorial is to read every word of these words Friends remember: If love can make things easier, then it simple! reading this tutorial method is to slow ! slowly, as the product of a woman, a cup of tea, you will find a lot of things in front before suddenly became very distant, and some things very far away but suddenly returned to the front ...
first overview What does a batch is about. batch definition, so far I have failed to give an appropriate number of experts have also ---- ---- Anyway, I did not give read and I do not know --- ---- I am not convinced is a rookie, of course, not to mention; but I would like to sum up a know that this is something, what you can do something with this stuff. Maybe you will, because this article and You love it, so I pulled, how can you with?? true love sometimes to such a drag, that is, so no reason, is so shameless! really!
as I understand, the nature of the batch , a bunch of DOS commands to form a certain set of order ..
OK, never claver and get to business (nonsense and get down to business). batch, also known as the batch script, translated into English BATCH, batch BAT file extension handling to take the first three letters. It constitutes no fixed format, as long as the subject to the following This has to ok: each line can be considered as a command, each command can be included in multi-stripe order, starting from the first line implementation until the end of the last line, which runs the platform is DOS. batch has a very distinctive features: easy to use, flexible, powerful, high degree of automation. I do not want to write a tutorial boring, because Qianchan to the code (approved be dealt with in the code, right?) problem has always been boring, very few people can face a screen full of code and settle down. So I will use the example of many simple and practical friend to read this tutorial to understand batch the charm of that great success, feeling that it was weird character, unconsciously in love with the batch (halo, how is love? in the end the batch, and love have anything to do? Answer: No!). and then say The following few lines of command and then save it as name.bat execution (after the text is given only the code, save, and execute a similar way):
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 not able to see to understand? is not very easy? but its role is very practical, the implementation of this batch, you can create in your current disk called a . txt file, it records the information which can help you quickly find the fastest QQ server, so far from the put things back where given,>> role, and> the same, the difference is the result appended to the results of the previous row behind, specifically, is the next line, and reached the front line of command The results will be retained, this could make the a.txt file more and more (think of how to sabotage the??). By the way, this batch can be combined with other orders, into an entirely automated to determine server speed of the East East, after the implementation of direct indication of the fastest servers IP, is not so cool? will detail later.
cases of two, and then give an example of outdated (a.bat):
@ echo off
if exist C: Progra ~ 1 Tencent AD *. gif del C: Progra ~ 1 Tencent AD *. gif
a.bat
why this is an example of outdated it? very simple, because almost no one now with a QQ with ads (KAO, my friend measurements also show that it QQ!!), so it is almost no access to the. but once its role is not a small glimpse of a: Remove QQ ads, so the dialog box clean. Here is the address of QQ with the default installation address, the default batch file name a.bat, of course you can modify the situation. In this script, if used command, makes it possible to achieve a timely assessment of the effect of pictures and delete ads, you only need to either close the DOS window after the command, do not press CTRL + C to force the termination order, it has to monitor whether there are advertising images (QQ also be continuously View their ads be removed). Of course, this script takes you a little bit of memory, Oh
learn batch! really want to learn it is easy!
friends read the first chapter, must have a first impression of the batch know what it is used in the end the of the. but you know the essence of the use of the batch is? is simple: ideas to be flexible! Nothing is impossible, only the unexpected. This love is a bit different, because The world is two people love the world of wishful thinking is not called love (to add: is called unrequited love. nonsense!) and the batch is a person's paradise, you can do whatever they want, not reached the realm!
batch looks messy, but it is the strong logic, absolutely better than many other programming languages (such as assembly) is low, if you write the script is a pile of mess, although each line commands are correct, but from the beginning to the end after the execution, was not necessarily the results you want, perhaps a screen Bad command or fail name. This is another and love have in common: Follow the steps to run, lack of or number of steps may lead to not want to see results. fell in love friends, I believe not sure this sentence is not. I love the batch, the output is not Bad command or fail name, the screen is so displayed: l love you r not an internal or external command, operable program or batch file. and then the cursor is flashing, wait for the next input errors.
from this chapter, the introduction of progressive approach commonly used in the batch command, a lot of common DOS commands in a batch script in this wide range of applications, they are part of the batch script BODY, but the batch is more flexible than DOS, but with automation. to learn batch, DOS must have a more solid foundation. Only some less used (relative to say) of DOS commands, common commands such as COPY, DIR, etc. do not do introduced (these seemingly simple command is actually complex, I'm afraid I say do not know!).
cases of five, look at an example . This is a very interesting script, a small and practical good stuff, the batch of process, first compile the source code, connect, and then run, and that there are many aspects to enter the middle of a lot of things, the trouble is (only experienced friends and understand). how to make this process a simple change? In We are engaged in curriculum design compilation, I >:: clean screen
echo This programme is to make the MASM programme automate
:: display info
echo Edit by CODERED
:: display info
echo Mailto me: qqkiller *** @ sina.com
:: display info
if ; help
:: if error pause to see 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
:: display usage
asked not to be the pile things to intimidated, stop and look carefully (think back to how the first chapter is written in the first paragraph!!). has been given the interpretation of each command, the contents of the two colon explain the contents of the former line E-text (the text's friends afraid of E do not worry, very easy, a look to understand, really do not understand not a dictionary, ah, so lazy?), the script is running does not show, nor have any role . penultimate first 5 trekking a colon, not a typo Oh! specific role mentioned in detail later. masm and link this script is the assembler and linker, procedures, and you must edit the source code to edit (of course And this script, nonsense!) together in the current directory. use this batch script, you can manually enter the maximum possible reduction of the whole process just press the Enter key a few times, you can achieve from the assembly source code into executable exe file of the automated conversion and has intelligent functions to determine: If the assembly source code when an error (compile failed), displays an error message is automatically suspended, and press any key to automatically edit the source code interface; If the source code to compile successfully is to connect, and the connection automatically generated exe file. In addition, because the batch command, simplicity and flexibility, this script can be improved also have a good, simple to modify to be able to meet a friend on a different machine habits.'m learning assembly friend, do not forget about practice!
appear in this script the following few commands: @, echo,::, pause,: and goto,%, and if. and this chapter will describe these commands.
1, @
everyone is familiar with this symbol, email essential symbols, how it will go to the batch as well? Oh, is not its fault, the batch would have to without it, or not perfect. It is to make the implementation of the window does not show it behind the line of the command itself (what a convoluted sentence!). Oh, simple language that the beginning of the line with it then the command line is not displayed. in cases of V, the first in line @ echo off @ role is to make the script does not display in the implementation of echo off the back part. This time to understand it? or less understand? It does not matter, after reading the echo command profile, naturally, understand.
2, echo
Chinese as It has only two states: on and off. so there is echo on and echo off the two commands. direct execution command will display the current echo echo command state (off or on) the implementation of echo off echo turned off, it later All commands are not displayed command itself, only shows the results after the execution, unless the Executive echo on command. In the cases of V, the first line and the echo off command @ commands together, achieved two purposes: echo off command itself does not show , does not show the line after the command itself. is indeed a bit messy, but if you practice the words, 3 minutes package will, will not refund!
echo command to use another one: You can use it to display information! as in Example V of the penultimate line, Default BAT file name is START.BAT after the execution of the script will be displayed in the window, while the echo command itself does not show (why ??).< br> echo another command Use two: You can directly edit the text file. Example VI:
echo nbtstat-A 192.168.0.1> a.bat
echo nbtstat-A 192.168.0.2>> a.bat
echo nbtstat - A 192.168.0.3>> a.bat
edit the content of the above script is a direct command line input, each line of a carriage return. Finally, in the current directory will generate a a.bat the files directly Executive will receive the results.
3,::
effect of this command is very simple, it is a comment command in the batch script and the rem command equivalent. it back when the content does not appear in the implementation, but also no effect, because it's just notes, just to increase the readability of the script, and the C language / * hhhh * / similar. earthlings can understand, do not say.
4, pause
Chinese as and displays one line message: Press any key to continue.. .. In the cases of the use of the Fifth twice this command, the first role is to allow users to see program information, the second is a compilation error code information ( In fact, not that it wants to show, but masm program displays an error message when it is temporarily stopped so that you see wrong with your source code).
5,: and why should it goto
introduced the two commands together? because they are inseparable, no matter which one or more of the less mistakes which will. goto is a jump command,: is a label. When the program runs to goto, it will automatically jump to: part of the definition to the implementation of the (not separated?). cases of the first trekking Fifth penultimate 5 A:, then the program runs automatically when the goto Jump to: label definition part of the implementation, the result is displayed script usage (usage is the tag name). easy to see, goto command is based on the colon and the label name to find its place in the jump, they are one to one relationship. goto command if the command is also often used in combination. As the specific use of these commands, refer to cases of five.
goto command to use another one: end the program early. in the program using the goto command to jump to the middle of a label, the contents of the tag is defined as the exit . such as:
hh
goto end
hh
: end
here: end the last line of the script! In fact, this example is mentally retarded, followed by about a combination of command and the command if you know .
6,%
the percent sign is not really strict orders, it is just a batch of parameters only (with the use of more than% except in the case, will be detailed later), but Do not think it is just a small argument to read it (see the number of cases where the Fifth use it?), Without it the function of the batch is reduced by 51% done. look at cases of seven:
net use % 1 ipc $% 3 / u: % 1 admin $ system32 / y
copy ipc2.BAT % 1 admin $ system32 / y
copy NWZI.EXE % 1 admin $ system32 / y
attrib % 1 admin $ system32 10.bat-r-h-s
Bat.Worm.Muma above code is part of the virus,% 1 representative IP, 2% on behalf of the username, 3% on behalf of password. implementation of the form: a parameter script file name parameter b hh. assume that the script is saved as a.bat, then perform the following form: a IP username password. Here IP, username , password is the three parameters, one can not (because the program can not run correctly, not because fewer parameter syntax is not right) so that the script execution, the script will automatically use your three parameters were used (remember that it was turn! is one to one relationship.) substitution of 1%, 2% and 3%, thus reaching the purpose of flexibility (Just think, if the script directly to the IP, username and password are the definition of death, then the script role will be fixed, but if you use%, the different parameters to achieve different purposes, is not more flexible?).
on the use of this parameter, will be introduced in the following sections. must be very skilled because as the process which requires lots of practice, hard work under the point of need!
this chapter to write here. may have friends ask: how not introduced if the command? Oh, I did not forget, but it is not easy make it clear that the next chapter to talk about this! This chapter of this something, if you are a beginner, I am afraid enough to digest the. remember saying: DOS is a batch BODY, any DOS commands can be used in a batch script to complete a specific function. come here, have you thought of the things with their stomach to write about stuff with automated color it? is simply just a collection of DOS commands, I believe that claim would you have for the talented computer grade examination papers in the DOS on the machine part of a batch to automate complete.
trouble! as if a semi-old woman to the menopause, a few nagging want what, what things are uncomfortable to see who who is hell. knowing that the tiger hill, undeterred, the last to leave a scar without success, they find that he was so fragile, so small, so vulnerable. hovering around the edge of collapse , suddenly recalled his last moment of flat people, really miss the (in fact I do not like flat people do not like being flat). I need to vent, I am trying very hard to beat with your fingers the keyboard, in a fit of then a burst of rhythmic voice, appeared on the screen above the text. Is this a vent may be another way? Chinese or severe, early on in the thousands of years ago, Confucius said, people, hard to support also Unfortunately, not to give myself, or this tutorial is not my writing!
there was a classic batch tutorial appears on your screen, you do not save the link until you find it only regret and, most painful than this. If God can give you a chance to watch it again, you would thing I read in tutorial three words: I love you! If you have a time limit to this love, You want to be 100 years. because after 100 years, you probably already dead! and now appears on your screen you are watching a batch of this tutorial, though not as good as you ever see the thing I read classics, but if the force also had to go. You will love it? 50 years time there will be so long? The answer is: Give it a try.
batch script a few of the most important commands detailed in this chapter, but it Unfortunately, some of the details up to now I did not grasp very well, and even some zoning. as not quite know how to love the same. But I have been trying, even if there has been no harvest. it may be more general talk, but I will tell you approach, the rest is a matter of time, so you need to hone. let us strive together. Rome was not built in a day, today is worth two in a day. Some things, like school batch, such as the love a person, are not crash, even while the harvest will have to pay as little difficult situation. Again, look at this tutorial, be sure to stop and, unless you have mastered this tutorial ---- but there is no need for all things looked a waste of time!
7, if
then the previous chapter, and then say if command. In general, if the command is a command to determine that, according to Each result obtained, it can correspond to a corresponding operation. on its three usage, speaking separately here.
(1), enter the judgments. or five inside the use cases that few words:
if usage
input parameters to judge the situation here, if the parameter is empty (no argument), then jump to the usage; If the argument is /? or help when (we usually see with the help of a command is not input /? or help it, do it here just to make the script look more like a real program), but also jump to the usage. where the negative form can also be used to mean ;==? in fact translated into Chinese to understand the taste.
(2), existential. look at cases where the second sentence:
if exist C: Progra ~ 1 Tencent AD *. gif del C : Progra ~ 1 Tencent AD *. gif
if those gif files, to delete these files. of course, the cases of four, is the same reason. Note that the conditions exist to judge is to determine, Of course, that does not exist can determine, for example, the following phrase, that deny it.
(3), determine the results. Or take the cases of five surgery (did not expect to write the script, actually use such a big, huh, huh):
masm% 1.asm
if errorlevel 1 pause & edit% 1.asm
link% 1.obj
first compile the source code, if it fails displays an error message is suspended, and press any key to automatically enter the editing interface; otherwise connected with the link generation process The obj file. here and tell us if the command is only relevant local, & command'll come back. This usage is to determine a command executed before the return code (also known as error code, DOS programs are run after to return to the code), and define the error code if found (error code defined here ...
No comments:
Post a Comment