MS-DOS lessons
Command line / batch (.bat)
MS-DOS was the operating system of personal computers from 1981 to the mid-1990s. There was no graphical interface; you communicated with the computer solely through the command line. Batch files — text files with the BAT extension — were a way to queue up these commands and automate them.
Batch files are limited as a programming language: variables are simple, there are no data structures, and error handling is primitive. In contrast, their job is clear — copying files, creating folders, running programs in sequence, and performing simple checks.
This knowledge still has relevance today: the Windows command prompt continues to support a large portion of MS-DOS commands, and BAT files are still used in the Windows environment as installation scripts, backup tasks, and scheduled jobs. Furthermore, knowing DOS commands is essential for understanding legacy systems.
- •→
Introduction to MS-DOS Batch
The first .bat file, printing with ECHO and clean output with @echo off.
- •→
Variables
Defining a variable with SET, using it with percent signs, and getting input from the user.
- •→
Conditions (IF)
Comparison with IF, file existence check, and use of ELSE.
- •→
Loops (FOR)
Looping over lists, number ranges, and files with FOR.
- •→
File Operations
File copying, moving, deleting, and redirecting output to a file.
- •→
Parameters and Subroutines
Passing external values to a file, branching with GOTO, and subroutines with CALL.
What you will learn
- Basic file and folder commands
- Printing to the screen with echo and managing the screen
- Writing and running a batch file
- Defining variables and receiving parameters
- Condition checking with if and branching with goto
- Processing file lists with the for loop
Who is this for?
- Those who need to write automation scripts in the Windows environment
- Administrators inheriting legacy systems or installation scripts
- Those interested in computer history and command line fundamentals
When to use?
For simple installation steps on Windows, file copying and backup tasks, and small scheduled jobs, batch files are still the shortest path — you don't need to install anything extra.
When things get complicated and error handling or data processing is required, switching to PowerShell is much healthier; PowerShell is the primary scripting language of modern Windows.
Frequently asked questions
Do MS-DOS commands still work in Windows?
A large portion of them do. The Windows command prompt supports classic commands like directory listing, file copying, and folder creation, and BAT files can be executed. However, low-level tasks like DOS-specific hardware access are no longer possible.
What is the difference between BAT and PowerShell?
BAT files are text-based and process command output as text. PowerShell, on the other hand, works with objects: the output of one command passes to the next as structured data. For complex tasks, PowerShell is incomparably more powerful; BAT, however, is shorter for simple tasks and runs everywhere.
Why do Turkish characters get corrupted in a batch file?
The command prompt uses an old code page by default. Saving the file in UTF-8 and adding the command that changes the code page to the command prompt usually solves the issue. This is also the most common problem encountered when migrating data from old DOS systems.
Is learning MS-DOS necessary today?
It's not mandatory, but it's useful. Command line logic — navigating between directories, redirecting output, batch-processing files — is the same in every operating system. The habits you learn here transfer directly to the Linux terminal as well.
Summary
MS-DOS commands and batch files continue to be the simplest automation tool in the Windows environment and teach the fundamentals of command line logic. In this tutorial, we progress from basic commands to batch variables, conditions, and loops.