As I wrote, RedirectOutput("c:\~:~") is the tricky part.

Spoiler: @SID is constantly outputted to the "~:~" stream of the "~" file...