Docs

RunMacro Documentation

Create your first robot, then go further as needed.

Clear step-by-step guides to create, run, and improve robots for repetitive computer work.

Docs Code Run .BAT File
⚙️ Code

Run a .BAT (batch) file in RunMacro

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

Prerequisites#

  • Add Run .BAT File to the macro.
  • Prepare the data or target that Run .BAT File will use.

Supported modes#

  • RunMacro Runner

What it does#

The Run .BAT File command executes a Windows batch (.bat) file. Use it to run system commands or existing scripts within your workflow.

Screenshots & video#

RunMacro Run .BAT File command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Run .BAT File command in RunMacro.

When to use it#

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

When not to use it#

  • Do not run BAT from an untrusted source or commands requiring a different shell/privilege context.

Configuration steps#

  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.

Every option explained#

File path (.bat)#

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

Expected result#

After execution, Run .BAT File completes the described action and makes its result available to the next step.

Real example#

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.

Limitations and failure cases#

  • Quoting, working directory, environment variables, and cmd exit codes affect results; scripts can modify the system.

Tips & common mistakes#

Only run .bat files you trust — batch can perform powerful system actions.

Verification details#

  • commands/code.py
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.