The first method of using a computer wasn’t through voice commands, touch-sensitive screens or even a mouse. In fact, it wasn’t quite accessible and you’d need a lot of ambition and patience to learn how to use one, because almost everything relied on code.
It doesn’t mean that coding is obsolete, now that every application and game looks so good and you hardly depend on any kind of text. On the contrary, coding still remains the building blocks of any program and game, with a large variety and languages to use.
In case you were ever wondering why Microsoft didn’t get rid of the Notepad, its basic text editor, then you might want to know that it can be used to create simple, or extremely complex Batch programs. With a little research, you can find multiple ways to use a plain text file to enhance your everyday computer activities. Below you find several commands and how they can be used.
Making a simple Batch file
Step 1: Right-click the desktop and choose to create a New Text Document. It needs to be a plain text file, not RTF or any Office formats.
Step 2: Do a little research on what commands you need, and most of all, what you want the new Batch program to do.
Note: Following these steps only creates a simple program that displays some text.
Step 3: Write down @ECHO OFF so that the code is not displayed in the final form.
Step 4: Press Enter to go to the second line, write ECHO then press space and add the information you want to be displayed.
Step 5: Go to the next line and write PAUSE just so the window stays up until user input. Otherwise, the window shows up for a second and closes automatically.
Step 6: Under the File menu, choose to Save As.
Step 7: Change the Save As Type to All Files from the corresponding drop down menu.
Step 8: Give the program a name and the .BAT extension.
Displaying text is not the only thing you can do with a Batch file. It all depends on how you combine functions. Some cases require heavy logic and use of special operators, and it’s probably the way you find out math is useful. As Wikipedia states, these are the available DOS commands, which can be used, since a Batch file is nothing more than a DOS script.
List of Batch commands
COMMAND | RESULT |
---|---|
APPEND | Set or display search path for files. |
ASSIGN | The command redirects requests for disk operations on one drive to a different drive. It can also display drive assignments or reset all drive letters to their original assignments. |
ATTRIB | Change or view attributes of one or more files. |
BACKUP and RESTORE | Original commands to backup and restore files. Replaced later on by CPBACKUP or MSBACKUP |
CALL | Invokes a Batch program from another Batch program |
CHCP | Displays or changes the active code page used to display character glyphs in a console window. |
CHKDSK | Checks a specific storage volume. |
CHOICE | Prompts user to choose from several options. |
CLS | Clears the terminal screen. |
COPY | Copies files to a specific location. |
DATE | Displays system date. |
DEL and ERASE | Delete one or more files. |
DIR | Shows contents of a directory. |
ECHO | Displays text on screen. |
EXIT | Closes the program. |
FC and COMP | Compares two files and shows differences. |
FOR | A loop syntax based on a set of conditions. |
MD or MKDIR | Creates a new directory. |
MOVE | Moves files to a specific location. |
PATH | Displays or sets a search path for executable files. |
PAUSE | Suspends all activity until user input. |
RD and RMDIR | Removes a directory. |
REM | Adds comment without any action. |
REN | Renames a file. |
SORT | Filters input data and sends it to output data stream. |
TIME | Displays system time. |
TITLE | Modifies the program title (shown in title bar). |
UNDELETE | Restores files deleted with the DEL command |
XCOPY | Copies entire directory tree. |