Cygwin - Run batch file in foreground

0

This seems like not possible. I've been trying to launch a batch file which has to run in foreground of the user session.

so I ssh to Cygwin of remote host and run the batch file and it always ends up in background.

ssh@Cygwin: cmd /c start.bat

Any suggestion to make it run in foreground?

Right now its just a dummy batch file but I want to create something that'll run in foreground which displays some stats.

user

Posted 2018-07-16T14:52:30.880

Reputation: 1

If you could create a scheduled task remotely and ensure it's set to run as that user account which is logged on that you want to see the screen, and with the option Run only when the user is logged on and execute the batch from there then that may work but you'd have to test to see if this is possible but I know when a scheduled task executes with that option as the user that the command window will be launched on the screen as that user session. You might try cmd /k too by the way and see if that makes any difference. – Pimp Juice IT – 2018-07-16T16:03:36.210

Answers

0

Windows services can't display UI anymore - so I don't think this is possible, see Stack Overflow for the technical details.

You would be better off writing a UI app that sits and waits for your script to publish out messages to it, then pops up and displays them.

dsolimano

Posted 2018-07-16T14:52:30.880

Reputation: 2 778