Is there a way to save all global variables to a text file?
In the comments, you indicate that you "just want to see [what] all the global variables are." In general, the easiest way to do this is to open the various ESP/ESM files in xEdit, which is a third-party modding tool. Although it is designed for modifying these files, it will give a very prominent warning before it actually lets you change anything, so it's perfectly usable as a viewer as well.
Once you've loaded Skyrim.esm and the DLC into xEdit, you can expand each of the ESP/ESM files in the panel on the left, which will show a list of categories. Expanding a category shows a list of individual records:
This image is showing Fallout 3, but the same app also works on Skyrim's plugin files. Under the "Global Variables" category, there will be one record for each global variable. Clicking a record will display it in the area to the right of the navigation tree. For a global variable, it will tell you the name of that variable and the value it has at the start of the game. For other records, you will usually see a much larger amount of information. Clicking the "Referenced By" tab at the bottom will also tell you about all the places where other records use the global variable in some way.
If you don't want to download third-party software, you can instead use the official Creation Kit (install via Steam under "Tools" for the original Skyrim, or from the Bethesda Launcher for the Special Edition). It also organizes data into categories and records. You'll find the list of global variables under Miscellaneous / Global. Unfortunately, running the CK is a bit tricky for multiple reasons:
- It won't let you load multiple files.
- It won't let you load DLC, because that requires loading both the DLC file and Skyrim.esm.
- It crashes if you look at it funny.
- Depending on your setup, various bits of functionality might be broken (particularly related to Papyrus scripting). You probably don't need to care about this just to look at the list of globals.
These problems are fixable; see particularly this mod and this thread on Nexusmods. In short, you need to fiddle around with skyrimeditor.ini because its default values are (in many places) incorrect or otherwise problematic.
SetConsoleOutputFilename
or scof
used to work in the old Fallout games. In Skyrim LE/SE the method is defined, but the implementation does not do anything.
There is a mod for the old Skyrim LE that logs the console output to a file. It is called ConSkrybe on the Nexus mods. It requires SKSE but it has not been updated in a while.
EDIT
There is a Skyrim SE mod called Console Commands Extender. This adds output redirection functionality for piping console output to a text file, clearing the console, and setting perk points. You can view the full Read Me