Difference Between Similar Terms and Objects

Difference Between CMD and BAT

computerCMD vs BAT

CMD and BAT are to files that are used to automate certain tasks that are repetitive and are used frequently by the user. Creating a CMD or BAT file is just like using a simple programming language with the advantages of the ability to use command line instructions and to execute other applications with or without parameters. CMD and BAT files are very similar to each other with very minor differences. BAT is a very old file type that has been around since the advent of DOS. It was carried over by Microsoft when it developed Windows away from DOS. The CMD file type was developed by Microsoft to be used for the implementation of Windows NT command scripts but is also in use by the newer versions of Windows that are based on Windows NT.

BAT was created to interact with COMMAND.COM, the command interpreter of DOS. Microsoft adopted most of the DOS commands into their new interpreter named CMD. EXE. CMD was created to interface with CMD.EXE and it breaks compatibility with COMMAND.COM. Another key difference is in how they handle the errorlevel variable. When using BAT, this variable is only changed once an actual error occurs and no change in state occurs when the each command executes successfully. This is not true for CMD as the errorlevel variable would still change state even if no errors occur. Programmers should take note of this when creating elaborate scripts as it may cause a little bit of confusion.

Aside from those minor differences, CMD and BAT are identical to each other. Most users who create simple scripts to clear or transfer files around should not encounter any problem. For users of the more recent versions of Windows, BAT and CMD are pretty much interchangeable as CMD.EXE would interpret and execute the commands in both files. Although most users are aware of this fact, a lot of the older people who had a chance to work with DOS and its batch files still use the BAT extension; simply out of habit and familiarity.

Summary:

1. The BAT extension is used by DOS and Windows while the CMD extension is for Windows NT Command Scripts

2. The BAT extension can be interpreted by COMMAND.COM and CMD.EXE while the CMD extension can only be interpreted by CMD.EXE

3. The errorlevel always changes state in CMD but only on errors in BAT

Sharing is caring!


Search DifferenceBetween.net :




Email This Post Email This Post : If you like this article or our site. Please spread the word. Share it with your friends/family.


Leave a Response

Please note: comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Articles on DifferenceBetween.net are general information, and are not intended to substitute for professional advice. The information is "AS IS", "WITH ALL FAULTS". User assumes all risk of use, damage, or injury. You agree that we have no liability for any damages.


See more about : , ,
Protected by Copyscape Plagiarism Finder