There are several ways to write scripts for Windbg and all of them
The obvious way is writing classic Windbg scripts. Those are basically just normal Windbg commands and a few control flow (meta-) commands. The easiest way to use classic Windbg script is by just chaining commands inside the Windbg command-line using '';'' as a separator. Once that gets complicated (after two or three commands) you can put them into a file and load it with the totally obvious command of
$$>><ScriptLocation or several variations depending on details of how your script should interact with Windbg. It is useful for creating macros of sorts, but trying to do anything advanced gets horrible fast. For instance you don't have variables, just the temporary t# registers and aliases that may or may not work as substitute for variables depending on the circumstances. Another problem is that everything inside a particular control flow block is put the Windbg command-line as a single line (separated by ';'). This lead to things like crashes that don't give any indication as to why they happened and side effects like things only really happening if you put them into arbitrary blocks.
I haven't tried this one, but if you want you can script Windbg from the outside with cmd.exe/.bat or Powershell.
That's why PyKd will get it's own chapter Page 5a where I will show some basics on how to use it.