请输入您要查询的百科知识:

 

词条 Command (computing)
释义

  1. Examples

  2. See also

  3. External links

  4. References

{{redirect distinguish|System command|system call}}{{other uses|Command (disambiguation)#Computing{{!}}Command#Computing}}{{unreferenced|date=May 2008}}

In computing, a command is a directive to a computer program acting as an interpreter of some kind to perform a specific task. Most commonly a command is either a directive to some kind of command-line interface, such as a shell, or an event in a graphical user interface triggered by the user selecting an option in a menu.

Specifically, the term command is used in imperative computer languages. These languages are called this, because statements in these languages are usually written in a manner similar to the imperative mood used in many natural languages. If one views a statement in an imperative language as being like a sentence in a natural language, then a command is generally like a verb in such a language.

Many programs allow specially formatted arguments, known as flags or options, which modify the default behaviour of the command, while further arguments describe what the command acts on. Comparing to a natural language: the flags are adverbs, whilst the other arguments are objects.

Examples

Here are some commands given to a command-line interpreter (Unix shell).

The following command changes the user's place in the directory tree from their current position to the directory {{Mono|/home/pete}}. The command is cd and the argument is {{Mono|/home/pete}}

The following command prints the text Hello World out to the standard output stream, which, in this case, will just print the text out on the screen. The command is echo and the argument is "Hello World". The quotes are used to prevent Hello and World being treated as separate arguments:

The following commands are equivalent. They list files in the directory {{Mono|/bin}}. The command is ls, the argument is /bin and there are three flags: -l, -t and -r.

 ls -l -t -r  /bin ls -ltr  /bin

The following command displays the contents of the files {{Mono|ch1.txt}} and {{Mono|ch2.txt}}. The command is cat, and {{Mono|ch1.txt}} and {{Mono|ch2.txt}} are both arguments.

Here are some commands given to a different command-line interpreter (the DOS, OS/2 and Microsoft Windows command prompt). Notice that the flags are identified differently but that the concepts are the same:

The following command displays the contents of the file {{Mono|readme.txt}}. The command is type, the argument is "readme.txt".[1]

The following command lists all the contents of the current directory. The command is dir, and "Q" is a flag requesting that the owner of each file also be listed. There is no argument.[2]

See also

  • Gesture recognition
  • List of Unix commands
  • List of DOS commands
  • Formal grammar

External links

{{Wikibooks|Guide to Windows commands}}
  • command from FOLDOC

References

1. ^{{cite web | url = https://ss64.com/nt/type.html | accessdate = 14 March 2019 | title = Type - Display a text file - Windows CMD | publisher = SS64.com }}
2. ^{{cite web | url = https://ss64.com/nt/dir.html | accessdate = 14 March 2019 | title = DIR - list files and folders - Windows CMD | publisher = SS64.com }}

3 : User interfaces|Computing terminology|Computing commands

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/20 9:09:54