Is there a way to create and store a function in skyrim for future use? I don't like having to re-enter codes all the time of what I commonly use, so I'd rather I be able to just call a function like function items() and it it activates something like

function items() {
  player.additem xxxxxx;
  player.additem xxxxxx;
  player.additem xxxxxx;

Or even just be able to store and call a variable via command line like:

$gem=player.additem 2E504 10;

1 Answer 1


I'm not aware of a way to use variables, but it is possible to create function-like batch scripts.

This can be done by creating an ordinary text file containing the commands you wish to run together (one per line, CRLF, no other delimiters). Save this file as e.g. myscript.txt in your Skyrim folder (in the same location as TESV.exe). In-game, you can then run this script via the bat console command:

bat myscript

Unfortunately, this does not appear to support arguments, so cannot be parameterized.

  • nice. gonna leave the question open for a couple of days to see if anyone has anything else. Nov 23, 2011 at 8:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .