Home Blog Archive Windows Batch files to create

Batch files to create

  • Nov 08, 2025
  • 674
  • 0

To create Batch files and program, you only need the Microsoft text editor - and, of course, Batch commands. In this practice tip, you will learn using small example programs, how to write Batch files.

The first steps - the Batch file to prepare

Thus the file in a Batch file to convert, you need to advance the file extensions view can. Then open the Editor. First, we create a program that you can use the Computer with a comment and a time of 20 seconds to shut down.
  1. You can start the command with: @echo off. Thus, the issue becomes clearer.
  2. Type in the next line "echo, you Want to the Computer is really shut down?".
  3. Including the command "break".
  4. In the next line, type in "shutdown-s -c 'This PC runs in 20 seconds' -t 2000". Overall, the Text looks like this:
  5. @echo off echo you Want to drive the Computer really down? break shutdown-s -c "This PC starts in 20 seconds" -t 20000
  6. Note that you enter only one command per line (see chart)
  7. Save the text file.
Simple Batch-file to create

The Textdatei.txt in a Batch file.bat convert and run

Still, you can't do anything with the text file and the Code. Therefore, you need to convert the text file into a Batch file.
  1. Click with a right click on the Textdatei.txt and select in the context menu "Rename".
  2. Change the file extension from ".txt" in ".bat". From the "Textdatei.txt" is a "text file.bat". Windows will warn you that the file may not work. Confirm the Change with "Yes".
  3. With a double click on the Batch file you run it. Now your PC shuts down.
File extension of .txt in .bat change

Additional Batch Commands

Even if Batch files are just simple programs, you can make much out of it. All of the Batch commands, if you are in the console "help". An example here is a small program with which processes are completed, a text file with a Text is created, and the Browser is started with google.de . You must validate each step with a push of a button.
  1. Again, you start with "@echo off".
  2. Underneath it, enter "taskkill /im iexplorer" to exit the Internet Explorer. The more processes you find when you type in the console "tasklist".
  3. In the next line, type "pause". Windows is now waiting for your next input.
  4. Below that, you type "echo This is a file > c:\test.txt a written".
  5. Now again, the command "pause".
  6. Finally, google.de is to be opened. To do this, enter "start https://www.google.de/". Overall, the Code looks like this:
  7. @echo off taskkill /IM iexplorer break echo will now be written to a file > C:\Test.txt break start https://www.google.de/
Batch File
Has been tested under Windows 7. You are at the program carefully. Some of the commands can cause in the wrong combination, significant damage to your Computer. Here you will get more useful tips for Windows XP and Windows 7.

YOU MAY ALSO LIKE

To remove Pokki - how to

  • Thu 13, 2025
  • 736
  • 0

Windows 7 uninstalling - how to

  • Tue 11, 2025
  • 548
  • 0

0 COMMENTS

LEAVE A COMMENT

Human?
1 + 3 =