For faster navigation, this Iframe is preloading the Wikiwand page for 命令 (电脑).

命令 (电脑)

电脑中,一个命令指的是为了完成某种特定任务,而向某种解释器程序发送的指示。 大部分情况下一个命令要么是发往某种命令行界面程序(例如壳层)的指示,要么就是在图形用户界面中通过用户选择某项菜单而引发的事件。

具体来说,命令这个词一般用于指令式电脑语言之中。之所以这些语言被这么称呼,是因为这些语言内的语句经常写成类似于自然语言中的祈使语气的样子。如果说指令式语言中的语句是自然语言中的句子的话,那么命令就是动词。

很多程序都可以使用特殊格式的引数来修改程序的一些行为,这样的引数被称为旗标或选项。接下来的引数描述指令操作的对象。 与自然语言相比较的话,选项就像副词,而其余引数则像受词

例子

以下为送往一个命令行界面解释器(Unix shell)的命令。

以下命令将用户在目录树内的位置从当前位置移动到 /home/pete。命令名是 cd,参数是 /home/pete:

 cd /home/pete

以下命令将 Hello World 打印到标准输出流(在此例中为屏幕本身)。 命令为 echo,其参数为 "Hello World"。 引号防止 Hello、World 被当作分开的参数:

 echo "Hello World"

以下命令是等价的,都列出目录 /bin 下的文件。 命令为 ls,参数为 /bin,有-l-t-r 三个选项。

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

以下命令显示文件 ch1.txt、ch2.txt 的内容。 命令为 catch1.txtch2.txt 均为参数。

 cat ch1.txt ch2.txt

以下列出一些送往另一种命令行解释器(DOSOS/2Windows命令提示字符)的指令。注意旗标的表示形式不同,但概念上是一致的: 以下指令列出当前目录下的所有内容。 命令名为 dir,“A”为旗标,没有参数。

 dir /A

以下命令显示文件 readme.txt 的内容。 命令名为 type英语TYPE_(DOS_command)参数为 “readme.txt”,“P” 为选项。

 type /P readme.txt

参见

外部链接

{{bottomLinkPreText}} {{bottomLinkText}}
命令 (电脑)
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?