Windows Batch

Batch files can be used to automate simple processes in Microsoft Windows. Batch files use the commands of the command prompt, in the simplest case these cmd commands can be entered in a simple text file line by line, it is then executed one command after the other. Windows batch originate from the MS-DOS era. At that time batch files had the file extension .bat. Since Windows 2000 the extension .cmd is used. Additionally there is the possibility to use jump labels or variables, up to more complex processes. From a certain complexity batch files are no longer the first choice. The successor of Windows Batch is Microsoft PowerShell.


Preview how to create a batch file - basics

how to create a batch file - basics

created: 2022-09-23 from Bernhard

A simple batch file is a text file containing a set of command prompt commands. A simple editor is sufficient to create the batch file. A text file saved in Windows/DOS with the extension .cmd or .bat, can be executed directly. Especially for very simple processes, for example copying files or folders, batch files may still be easier than using PowerShell. At the latest, if commands should not be executed in sequence and certain if-queries, loops or functions are necessary, I would recommend the... ... continue reading

Preview Practical examples with batch

Practical examples with batch

created: 2022-11-08 from Bernhard

Handling variables in Windows Batch (command prompt) Read all variables Variables can be read out in the command prompt with the set command: ... continue reading

Preview Structure of a batch file Syntax: echo off cmd

Structure of a batch file Syntax: echo off cmd

created: 2022-09-23 from Bernhard

If you have created a batch file, you can write a command in each line, see: how to create a batch file - basics. The commands are executed in sequence when the file is started. The behavior of the output can be adjusted as follows: ... continue reading

Preview Sequence loops and jump labels batch file: loop goto

Sequence loops and jump labels batch file: loop goto

created: 2022-11-04 from Bernhard

Jump marks: Example: ... continue reading

Preview cmd command Windows Management: Control Panel cpl and msc

cmd command Windows Management: Control Panel cpl and msc

created: 2023-02-27 from Bernhard

cmd command Windows Administrative Tools: Control Panel cpl and msc ... continue reading

Preview CMD Commands Overview: BATch Commands Windows Command Prompt

CMD Commands Overview: BATch Commands Windows Command Prompt

created: 2023-02-24 from Bernhard

An introduction to Windows-BATch or the Windows-Command-Line can be found here: Windows Batch ... continue reading

Preview sleep or wait in batch files: pause cmd

sleep or wait in batch files: pause cmd

created: 2022-05-02 from Bernhard

The function wait or sleep was not available in BATch files by default.Remedy is a small detour via the ping Command ... continue reading

Preview Robocopy example - server relocation

Robocopy example - server relocation

created: 2022-12-12 from Bernhard

Even in times of Windows PowerShell there are certain commands that still do not have a worthy successor in Windows PowerShell. One of these commands is undoubtedly the good old robocopy command. ... continue reading

Preview Execute remote commands with psexec pstools - cmd Windows

Execute remote commands with psexec pstools - cmd Windows

created: 2023-03-01 from Bernhard

The pstools can be used to execute commands on other computers: Of course, this requires the necessary rights for the remote connection: by default, these are the domain administrator or the local administrator. As an alternative for a remote connection to another computer, PowerShell remoting can also be used, see: Powershell Remote ... continue reading

Übersetzung Deutsch