You would not want to queue a separate sbatch command to do this. If you used the OpenHPC stack, you could potentially use
wwsh ssh -a <command> where the
-a is for all or alternatively replace this with the nodes that you want to run the command on.
As for doing it from your existing batch script, have you considered using
expect program would allow you to type something like
send -- "t\r" (the t character followed by a return key) if the time that you needed the input to be run would be deterministic. If you want more information on
expect, check out something like https://likegeeks.com/expect-command/ .
In my experience can be helpful if your cluster doesn't have a lot of space or you want max performance to use a command line only approach instead of installing x11 on a system (or at least the parts of it required to run
xdotool). Personal comfort level will dictate this.