Skip to main content

Batch programming

>>>>>>>>>>>>>>>>>>>>>>>>>>The computer user is used to the computer executing its commands directly, i.e. in dialog.


Developers and system administrators, however, very often let the computer process tasks in the background without requiring any interaction. To keep CPUs and memory resources free for a company’s day-to-day operations, resource-intensive processing is often moved to the night and automated through batch processing. Writing the batch commands needed to do this is called batch programming


How do I program a batch file?

Typical scripting languages, such as PowerShell, are suitable for creating a batch file. The execution of the batch file is triggered either manually or with a task scheduler integrated in the operating system. Under Windows, access to the task scheduler is located in the Control Panel. The batch file can be scheduled to run once or periodically. Basically, the same commands apply to batch programming as otherwise. The only thing the developer must keep in mind when batch programming is that the code runs in the background at runtime, whether visually visible or not, and does not allow user interaction.

Using the Batch File

An empty text file with the extension .bat or .ps1 can be saved as a shell for the batch file. The ping command is entered in this file with the parameter -t for any computer. As soon as the file is started in the CMD window (.bat file) or PowerShell window (ps1. file) or passed to the Windows task scheduler, the script monitors all desired computers. Further lines can be added, which define the reactions in case of a timeout of the ping command.

Do you have any more questions?

Please contact us