Commands usually set error level at the end of their execution. In Windows NT and later, it is a 32-bit signed integer; in MS DOS, it used to be an integer from 0 to 255. Keywords: return code, exit code, exit status.
https://en.wikibooks.org/wiki/Windows_Batch_Scripting
Step 1: Create A BAT File. Create a new text document on your desktop. Double click the file – it should be blank inside. Now, go to file>save as, and in the “Save As” window, input a name for your BAT file and then add a “.bat” on the end (without the quotes). My file was named testBAT.bat, for instance.
http://www.makeuseof.com/tag/write-simple-batch-bat-file/
A batch file is a kind of script file in DOS, OS/2 and Windows. It consists of a series of commands to be executed by the command line interpreter, stored in a plain text file. A batch file may contain any command the interpreter accepts interactively and use constructs that enable conditional branching and looping within the batch file, such as if, for, goto and labels.
https://en.wikipedia.org/wiki/Batch_file
For variable specifications that name batch file parameters (i.e. that are non-negative decimal numbers), the replacement is the value of the parameter taken from the arguments with which the batch file was invoked (subject to any subsequent modifications by the SHIFT command).
https://en.wikibooks.org/wiki/Windows_Batch_Scripting
I’ll also provide you with a few resources for learning to write batch (.bat) files in case you’d like to go further. Let’s say that you frequently have network issues; you’re constantly getting on the command prompt and typing in things like “ipconfig” and pinging Google to see what the problem is.
http://www.makeuseof.com/tag/write-simple-batch-bat-file/
The percent sign (%) is a special case. On the command line, it does not need quoting or escaping unless two of them are used to indicate a variable, such as %OS%. But in a batch file, you have to use a double percent sign (%%) to yield a single percent sign (%).
https://en.wikibooks.org/wiki/Windows_Batch_Scripting
Step 2: Learn Some Quick Code. If you know how to run commands in the command prompt, you’ll be a wiz at creating BAT files because it’s the same language. All you’re doing is telling the command prompt what you want to put in through a file, rather than typing it every time you run the command prompt.
http://www.makeuseof.com/tag/write-simple-batch-bat-file/
The value of the PATHEXT environment variable comprises a list of filename extensions, separated by semi-colon characters. This is the list of filename extensions that are applied, in order, when locating the program file of an external command to execute.
https://en.wikibooks.org/wiki/Windows_Batch_Scripting
OS/2's batch file interpreter also supports an EXTPROC command. This passes the batch file to the program named on the EXTPROC file as a data file. The named program can be a script file; this is similar to the #! mechanism.
https://en.wikipedia.org/wiki/Batch_file
When a batch file is run, the shell program (usually COMMAND.COM or cmd.exe) reads the file and executes its commands, normally line-by-line. Unix-like operating systems (such as Linux) have a similar, but more flexible, type of file called a shell script. The filename extension .bat is used in DOS and Windows.
https://en.wikipedia.org/wiki/Batch_file
what is a windows batch file
A windows batch file is  kind of script file in DOS, OS/2 and Windows. A batch file is a kind of script file in Disk Operating System, Operating System 2 and Windows.