DocsCodeRun .BAT File

Run a .BAT (batch) file in RunMacro

RunMacro RunnerRunMacro 3.5+

The Run .BAT File command executes a Windows batch (.bat) file.

Dialog & quick setup

RunMacro Run .BAT File command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Run .BAT File command in RunMacro.
  1. Add a Code › Run .BAT File command.
  2. Choose the path to the .bat file.
  3. Save. On run, it is executed via cmd.

Options reference

File path (.bat)

The batch file to run; the working directory is the file location.

Modes & when to use

RunMacro Runner

Best for

  • Run an existing .bat to clean up/start a service.
  • Call Windows system commands in a workflow.
  • Integrate existing command-line tools.

Use an alternative when

  • Do not run BAT from an untrusted source or commands requiring a different shell/privilege context.
Before you run
  • Add Run .BAT File to the macro.
  • Prepare the data or target that Run .BAT File will use.

Example workflow

Common Use Case: Running a Daily System Cleanup Script (.bat)

  1. Create a cleanup.bat file (e.g., deleting temporary files in %TEMP% or clearing Downloads) containing maintenance commands like del /q /f /s "%TEMP%\*".
  2. Add a Code › Run .BAT File command in RunMacro and select the path to your cleanup.bat file.
  3. Combine with the Scheduler feature in RunMacro Runner to execute the cleanup automatically every day without opening CMD manually.
  4. Looking to run or schedule batch scripts directly in Windows? Read our complete guide on how to run a .bat file in Windows 10 & 11.
Expected result: After execution, Run .BAT File completes the described action and makes its result available to the next step.

Tips & limitations

Only run .bat files you trust — batch can perform powerful system actions.
  • Quoting, working directory, environment variables, and cmd exit codes affect results; scripts can modify the system.

Applies to RunMacro 3.5+ · RunMacro Runner · Windows 10/11

RunMacro robot

Robots do the work. Your time is yours.

Create a robot in minutes, no coding needed. Reliable execution, remote management, transparent costs — and you always stay in control.