Thanks for getting in touch! Octopus variables aren't stored in any file. As there are different kinds of variables (system variables, library variable sets, project variables), which variables are you wanting to retrieve? Knowing a bit more about your requirements and what you're after will help us come to the best solution. :)
Thanks for following up. Unfortunately we don't have any built-in way to collect and print all variables. Since there are different kinds of variables, which are stored separately, this would need to be done manually for each location in which we store the variables. This would be for each project, library variable set, tenant variables, etc.
Via the API, you could do something like:
get all projects, order alphabetically
print out name of the project
print out all of its variables
Then do something similar for your variable sets, and tenant variables. You'd also need to make sure you're logged in as a user with access to all things you could scope these variables to.