For faster navigation, this Iframe is preloading the Wikiwand page for 批处理文件.

批处理文件

本条目存在以下问题,请协助改善本条目或在讨论页针对议题发表看法。 此条目需要精通或熟悉相关主题的编者参与及协助编辑。 (2014年9月26日)请邀请适合的人士改善本条目。更多的细节与详情请参见讨论页。 此条目可参照英语维基百科相应条目来扩充。 (2020年8月9日)若您熟悉来源语言和主题,请协助参考外语维基百科扩充条目。请勿直接提交机械翻译,也不要翻译不可靠、低品质内容。依版权协议,译文需在编辑摘要注明来源,或于讨论页顶部标记((Translated page))标签。 此条目需要补充更多来源。 (2022年8月2日)请协助补充多方面可靠来源改善这篇条目无法查证的内容可能会因为异议提出而被移除。致使用者:请搜索一下条目的标题(来源搜索:"批次档"网页新闻书籍学术图像),以检查网络上是否存在该主题的更多可靠来源(判定指引)。
批处理文件(Batch file)
扩展名
.bat .cmd .btm
互联网媒体类型application/x-bat
格式类型脚本语言
作为容器Shell script

批处理文件(英语:Batch file),又称批次档,在DOSOS/2Microsoft Windows中,是一种用来当成脚本语言运作程序的文件。它本身是文本文件,其中包含了一系列让具备命令行界面解释器读取并执行的指令。它应用于DOSWindows系统中,它是由DOS或者Windows系统内嵌的解释器(通常是COMMAND.COM或者CMD.EXE)解释运行。它相当于是类Unix系统下的Shell script

DOSWindows 9x操作系统家族中,批处理文件的文件扩展名为.bat。在OS/2Windows NT操作系统家族,添加了.cmd这个文件扩展名。在其他操作系统中,批处理文件可能具有不同的扩展名,例如,4OS,4OS2和4NT使用.btm文件扩展名。当执行批处理文件时,shell程序会读取文件内容,之后通常是以逐行的方式,执行它的命令。其最简单的例子,是逐行书写在命令行中会用到的各种命令。也可以在批处理文件后面加上更多种类的参数。更复杂的情况,需要使用if、for、goto、choice等命令控制程序的运行过程,如同C语言Basic等高级语言一样。如果需要实现更复杂的应用,利用外部程序是必要的,这包括系统本身提供的外部命令和第三方提供的工具或者软件。批处理程序虽然是在命令行环境中运行,但不仅仅能使用命令行软件,任何当前系统下可运行的程序都可以放在批处理文件中运行。

有些人认为批处理语言的含义要比上面的描述更广泛,还包括许多软件自带的批处理语言,如 Microsoft OfficeVisual StudioAdobe Photoshop 所内建的批处理语言的功能,用户可通过它们让相应的软件执行自动化操作(例如调整某个资料夹所有 PSD 图档的分辨率)。 而这类批处理语言也大多提供把一系列操作录制为批处理文件的功能,这样用户不必写程序就能得到批处理程序。[1]

参考资料

[编辑]
  1. ^ 赖荣枢. 易學易用的 Windows PowerShell. Microsoft TechNet. 2006-06-01 [2014-03-05]. (原始内容存档于2020-02-02). 

参见

[编辑]
{{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?