# File contents or exe output to variable

**URL:** https://www.finalbuilder.com/forums/t/file-contents-or-exe-output-to-variable/5588
**Category:** Discussion
**Created:** [October 6, 2017, 5:55am UTC](https://www.finalbuilder.com/forums/t/file-contents-or-exe-output-to-variable/5588 "2017-10-06T05:55:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![matthew](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/matthew/32/189_2.png) [@matthew](https://www.finalbuilder.com/forums/u/matthew)
#### Post date: [October 6, 2017, 5:55am UTC](https://www.finalbuilder.com/forums/t/file-contents-or-exe-output-to-variable/5588/1 "2017-10-06T05:55:16Z")

</div>

Is it possible to get the contents of a file or the output of an executable into a variable?  
  
Thank you,  
Matthew

---

<div class="post-metadata">

### Author: ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)
#### Post date: [October 9, 2017, 12:22pm UTC](https://www.finalbuilder.com/forums/t/file-contents-or-exe-output-to-variable/5588/2 "2017-10-09T12:22:43Z")

</div>

Hi Matthew,  
  
There are no actions in Continua CI specifically for reading file contents (or for reading action output into a variable). You will need to call a FinalBuilder project, or other script, batch file or program to do this using the FinalBuilder, PowerShell, Run Dos Command/Batch File, Execute Program or DotNet Run actions  
  
With FinalBuilder, you can use the [Read Text File](http://wiki.finalbuilder.com/display/FB8/Read+Text+File+Action) action to read the contents into a variable. The[Log to Variable](http://wiki.finalbuilder.com/display/FB8/Logging+Properties) logging option can be used to get the exe output into a variable. You can then use the Continua CI - Set Variable action to set the Continua CI variable from FinalBuilder.  
  
You can set Continua CI variables from other scripts or programs by writing [Custom Log Messages](http://wiki.finalbuilder.com/display/continua/Custom+Log+Messages) to standard output.  
  
e.g. With PowerShell

`$fileContents = (Get-Content ``“./myFile.txt”` `-Raw).Replace(``“rn”``, ``“\n”``) `

`write-Host ``“@@continua[setVariable name=‘myFileContents’ value=’$fileContents’]”`
