windows *.bat 和 *.cmd 文件有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5347593/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the difference between *.bat and *.cmd file?
提问by smwikipedia
Possible Duplicate:
Windows batch files: .bat vs .cmd?
Hi,
你好,
I am learning Windows Batch programming and come across this question:
我正在学习 Windows 批处理编程并遇到这个问题:
What's the difference between .batand .cmdfile?
.bat和.cmd文件有什么区别?
If they are the same, why need 2 of them?
如果它们相同,为什么需要它们中的两个?
BTW, what's the difference between command.comand cmd.exe?
顺便说一句,command.com和cmd.exe 有什么区别?
采纳答案by Ken White
.bat
files are left-overs from DOS. .cmd
files are for Window NT command processor or higher, and have more capabilities (some looping structures, the ability to call and return from procedural type blocks).
.bat
文件是 DOS 遗留下来的。.cmd
文件用于 Window NT 命令处理器或更高版本,并且具有更多功能(一些循环结构,调用和从过程类型块返回的能力)。
command.com
was what ran the operating system and contained the internal commands like dir
in DOS and early versions of Windows. It was replaced by cmd.exe
when Windows NT was introduced, and was the first 32-bit command processor.
command.com
运行操作系统并包含内部命令,如dir
DOS 和早期版本的 Windows。它cmd.exe
在 Windows NT 推出时被取代,并且是第一个 32 位命令处理器。
回答by Ranjanmano
This might help you
Windows batch files: .bat vs .cmd?
http://www.pcreview.co.uk/forums/cmd-vs-bat-t1468592.html
A documented difference found in google groups
The differences between .CMD and .BAT as far as CMD.EXE is concerned are:
With extensions enabled, PATH/APPEND/PROMPT/SET/ASSOC in .CMD
files will set ERRORLEVEL regardless of error. .BAT sets ERRORLEVEL
only on errors.
这可能对您有所帮助
Windows 批处理文件:.bat 还是 .cmd?
http://www.pcreview.co.uk/forums/cmd-vs-bat-t1468592.html
在谷歌组中发现的记录差异
就 CMD.EXE 而言,.CMD 和 .BAT 之间的差异是: 使用扩展启用后,.CMD 文件中的 PATH/APPEND/PROMPT/SET/ASSOC 将设置 ERRORLEVEL,无论错误如何。.BAT 仅在错误时设置 ERRORLEVEL。