# send script output to a file

**URL:** <https://forum.mikrotik.com/t/send-script-output-to-a-file/116250>\
**Category:** Scripting\
**Created:** [February 5, 2018, 8:55am UTC](https://forum.mikrotik.com/t/send-script-output-to-a-file/116250 "2018-02-05T08:55:11Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![dana1975](https://forum.mikrotik.com/letter_avatar/dana1975/32/6_449c533f586939b6e5f246632a46421f.png) [@dana1975](https://forum.mikrotik.com/u/dana1975)\
**Post date:** [February 5, 2018, 8:55am UTC](https://forum.mikrotik.com/t/send-script-output-to-a-file/116250/1 "2018-02-05T08:55:11Z")

</div>

i want to send the out script to a file, i set the variable $contents and i need to send this variable to a text file

:local updown  
:local up  
:local down  
:local totaldown  
:local name  
:local contents

:foreach counter in=[/queue simple find] do={  
:set $updown [/queue simple get $counter bytes]  
:set $up [:pick $updown 0 ([:find $updown “/”])]  
:set $down [:pick $updown ([:find $updown “/”]+1) 255]  
:set $totaldown ($up+$down)  
:set $name [/queue simple get $counter name]  
#:put (“Name”, $name, “Upload/Downoad” , $updown , " Upload:" , $up " Download:" , $down" Total Download:" , $totaldown)  
:set $contents (“Name”, $name, “Upload/Downoad” , $updown , " Upload:" , $up " Download:" , $down" Total Download:" , $totaldown)  
}}

---

_[View the full topic](https://forum.mikrotik.com/t/send-script-output-to-a-file/116250)._
