What's the difference between *.bat and *.cmd file? [duplicate]

你说的曾经没有我的故事 提交于 2019-12-31 11:02:56

问题


Possible Duplicate:
Windows batch files: .bat vs .cmd?

Hi,

I am learning Windows Batch programming and come across this question:

What's the difference between .bat and .cmd file?

If they are the same, why need 2 of them?

BTW, what's the difference between command.com and cmd.exe ?


回答1:


.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).

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.




回答2:


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.



来源:https://stackoverflow.com/questions/5347593/whats-the-difference-between-bat-and-cmd-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!