Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
2 К ПС(мережі 1, 2 семестр).doc
Скачиваний:
0
Добавлен:
01.03.2025
Размер:
3.75 Mб
Скачать

Other commands

All commands from the interactive mode can be used in batch files; similarly, one can use batch-file commands directly on the command.com command line, interactively. Therefore, it is impossible to separate the syntax to "interactive" or "batch" commands.

ECHO 

Toggles whether text is displayed (ECHO ON) or not (ECHO OFF). Also displays text on the screen (ECHO text). @ECHO OFF prevents this command from being displayed and only works in a batch file.

SORT 

Sorts the output of another command into a file or the like.

SET 

Sets the value of an environment variable

PAUSE 

Halts execution of the program and displays a message asking the user to press any key to continue.

SHIFT 

Replaces each of the command-line variables with the consequent one (e.g. %0 with %1, %1 with %2 etc. - see below for more information on variables).

CHOICE 

Presents the user with a menu (MS-DOS 6 and higher). Defaults to Y/N.

CALL 

Pauses execution of one batch file, runs another, and returns to the old one and continues.

COMMAND 

The COMMAND command starts a new copy of command.com.

EXIT 

Exits from a new copy of Command.com, or exits the dos prompt in windows.

VER 

This command is built into command.com and displays the current version.

Control structures

Control structures are mostly used inside batch files, although they can also be used interactively.

FOR 

Iteration: repeats a command for each out of a specified set of files.

GOTO 

Moves execution to a specified label. Labels are specified at the beginning of a line, with a colon (:likethis).

REM 

Comment: any text following this command is ignored

IF 

Conditional statement, allows to branch the program execution

Variables

Batch files for command.com can be said to have 4 kinds of variables:

  1. ERRORLEVEL - contains the return code of the last program to run that sets a value (an integer between 0 and 255). Most programs have a certain convention for their return codes (for instance, 0 for a successful execution). Some programs do not establish a new value, and thus the older value persists after they execute. The value of ERRORLEVEL is tested for range with the IF statement.

  2. Environment variables - these have the form %VARIABLE% and are associated with values with the SET statement.

  3. Command-line parameters - these have the form %0, %1...%9, and initially contain the command name and the first nine command line parameters passed to the script (e.g., if the invoking command was "myscript.bat John Doe", then %0 is "myscript.bat", %1 is "John" and %2 is "Doe"). The parameters to the right of the ninth can be mapped into range by using the SHIFT statement.

  4. "For" variables - used by loops, have the format %%a. These variables are defined solely within a specific FOR statement, and iterate over a certain set of values defined in that FOR statement.

16. The founder of the Microsoft.

Everyone has heard of Bill Gates? He is the icon of business and the richest man in the world. Microsoft, the business he started with a friend in 1975, has become the world’s largest computer software company. Bill Gates was born on the 28th of October, 1977, in Seattle, USA. From his parents Bill received a good business sense and a quick mind.

At school Bill soon showed that he was very intelligent. His favorite subjects were Math and Science. At 13 he got interested in computers. Bill Gates and his friend Paul Allen were soon spending all their time learning computers and writing programs instead of doing their homework. After finishing school, Bill entered Harvard, the most famous university in the USA. He and Paul Allen wrote an operating program for Altair, one of the world’s first microcomputers.

Bill left Harvard before finishing his studies. Two friends started Microsoft in 1975, and very soon it became successful. In 1980, Gates bought a small company that produced an operating system called DOS. He made some changes and renamed it MS-DOS. He sold the rights to use this system to IBM. Since 1980 MS-DOS has been the standard operating system for all PCs. Microsoft has also developed such well known programs as Windows, Excel and Internet Explorer.

Bill’s dream is to computerize everything – TVs, telephones, even the way we cook dinner.

One reason of his success is that Bill has always been very ambitious and hard-working. Bill Gates has written two famous books: “Road Ahead” and “Business and the Speed of Thought”. Both books are best-sellers. Bill hasn’t got much free time, but when he has a chance he likes playing golf and bridge. He is also fond of reading about science.

For such a rich person his life is very simple, and he spends very little time on himself. When it comes to helping others, Gates is very generous. He has already given more than $ 300 millions to charity.