Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

April 28, 2025

Creating and Using Windows Batch files

In this article you learn how to create and use Windows Batch files by simply using the Windows pre installed notepad editor.

What is a batch file and what can I do with it?

A batch file or MSDOS batch file is a simple list of Windows commands that the computer shall execute.

In Windows the Command Line Interpreter CMD.exe is running a batch file.

Batch files can be used for calling programs that need to be run with parameters or for example executing routines on a file system.

Which commands can be used?

Generally all commands the CMD.exe knows can be used.

To get a full list of the commands go to: Start >> Execute >> cmd.exe

In the command line type ‘help’ and hit Enter. You should see a full list of the available commands.

On the right there is a screenshot from Windows XP showing the available commands (German).

You can also execute other programs from CMD by typing the full absolute path or relative path and hitting Enter.

Be careful when using commands like ‘del’ and ‘format’ and think twice before executing a command like these! They can cause irreversible loss of data, as the ‘del’ or ‘format’ command are not moving deleted files to the Windows Trash Bin!

CMD commands

How to create a batch file?

Example Batch file

Batch files can easily be created using the Windows pre-installed editor notepad.exe (Start >> Run >> Notepad.exe).

Open this editor and type the commands you want to excude with the proper parameters.

Write only one command per each line (see example on the left).

In order to create an executable file you have to save the file as *.bat 

Don’t forget to put this file extension to your file while saving.

Make sure your file is not a name like MyBatch.bat.txt as the txt is the file extension in this case.

To execute your batch file simply double click on it in Windows Explorer and it will be run by CMD.exe.

To edit your batch file right click on it >> Edit to open it in the Notepad Editor again.

File extension .bat

This article is also available in German on Computer-Masters.de

You may also be interested in the following articles:

One thought on “Creating and Using Windows Batch files

Leave a Reply

Your email address will not be published. Required fields are marked *