Unfortunately, applications for the console subsystem will almost always require some modification to survive logoff. It's only 7 lines of C code or so, and you can see src/
tcl-nologoff.c for an example.
A lot of scripting language interpreters have a special variant of executable in their Windows versions: the executable is linked for the windows subsystem, not the console one, though it doesn't provide GUI per se. I recommend to use this kind of interpreters for your service, together with
-ipcmethod pipe.
As of TCL (tclsh*.exe console interpreter), nologoff.dll included in the winserv support package takes care of making the interpreter ready to survive logoff. Winserv::startup will load this dll. If you use
freewrap to create a
stand-alone executable, you should copy this dll to the real filesystem and let the winserv support package know where it is: