CMD Master
Back to Blog
Arnošt Havelka

Revision 6: Automation & File Comparison

Create batch scripts and compare files to master advanced file operations.

Start Interactive Lesson
Revision 6: Automation & File Comparison

Welcome to advanced territory! In this final revision, you'll combine command redirection with batch scripting and learn how to compare files for differences. These skills unlock powerful automation capabilities.

Try the command

Create a batch file with echo redirection!

Build the command
echo >
Choose a command
Terminal
C:\Users\User>echo copy *.txt backup > backup.bat

Challenge 1: Create a Batch Script

Write a command to a batch file using echo and redirection. This creates an executable script that can run the same operations repeatedly without retyping.

Command Prompt
C:\Users\User>echo copy *.txt backup > backup.bat

By redirecting echo output to a .bat file, you've created a reusable script. Running backup.bat from the command line will execute the stored command automatically — perfect for repetitive tasks.

Challenge 2: Compare Files

Use the fc (file compare) command to identify differences between two files. This is crucial for verification and debugging.

Try the command

Compare two configuration files!

Build the command
fc
Choose a command
Terminal
C:\Users\User>fc config.ini config-backup.ini
Command Prompt
C:\Users\User>fc config.ini config-backup.ini

The output shows differences between files. Each ***** marker indicates where files diverge. This is essential for version control, configuration audits, and detecting data corruption.


Knowledge Check

1 / 4

What does the > operator do in echo commands?

References

These documentation links provide authoritative details for the commands used in this article.

Up Next

Opening Files in a Text Editor

Learn to open and edit files with Notepad directly from the command line.