# Outputs.exec example batch file windows

**URL:** <https://community.influxdata.com/t/outputs-exec-example-batch-file-windows/57964>\
**Category:** Telegraf\
**Tags:** telegraf\
**Created:** [September 22, 2025, 12:44pm UTC](https://community.influxdata.com/t/outputs-exec-example-batch-file-windows/57964 "2025-09-22T12:44:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeroenVH](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jeroenvh/32/20157_2.png) [@JeroenVH](https://community.influxdata.com/u/JeroenVH)\
**Post date:** [September 22, 2025, 12:44pm UTC](https://community.influxdata.com/t/outputs-exec-example-batch-file-windows/57964/1 "2025-09-22T12:44:30Z")

</div>

Does someone have a working example on how to use the exec output with a batch file?

If I could just get the telegraf output logged to a file, I can continue to edit the script to my needs. But currently I only get an error.

```auto
[outputs.exec] Command error: {"'.' is not recognized as an internal or external command,\noperable program or batch file.\n" '\x00' '\x00'}

```

> **Exec config**
>
> ```auto
> [[outputs.exec]]
> alias = "move_secondary"
> command = ['./log.bat']
> 
> flush_interval = "1s"
> metric_batch_size = 1000
> metric_buffer_limit = 100000
>   
> data_format = "influx"
>   
> log_level = "debug"
> 
> ```

> **batch file**
>
> ```auto
> @echo off
> REM Append stdin to output.txt
> type con >> output.txt
> 
> ```

---

<div class="post-metadata">

**Author:** ![R290](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/r290/32/9425_2.png) [@R290](https://community.influxdata.com/u/R290)\
**Post date:** [September 24, 2025, 12:51pm UTC](https://community.influxdata.com/t/outputs-exec-example-batch-file-windows/57964/2 "2025-09-24T12:51:41Z")

</div>

I assume you’re on Windows? Maybe this works:

```auto
[[outputs.exec]]
  alias = "move_secondary"
  command = ['cmd.exe /C "call .\log.bat"']

  flush_interval = "1s"
  metric_batch_size = 1000
  metric_buffer_limit = 100000
  
  data_format = "influx"
  
  log_level = "debug"

```

---

<div class="post-metadata">

**Author:** ![srebhan](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/srebhan/32/8572_2.png) [@srebhan](https://community.influxdata.com/u/srebhan)\
**Post date:** [September 24, 2025, 1:35pm UTC](https://community.influxdata.com/t/outputs-exec-example-batch-file-windows/57964/3 "2025-09-24T13:35:18Z")

</div>

@JeroenVH on Windows `./` will not work…
