File contents or exe output to variable

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

Thank you,
Matthew

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 action to read the contents into a variable. The Log to Variable 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 to standard output.

e.g. With PowerShell

$fileContents = (Get-Content “./myFile.txt” -Raw).Replace(rn”, “\n”)
write-Host “@@continua[setVariable name=‘myFileContents’ value=’$fileContents’]”

1 Like