Re: Close Application directly after disconnect (not in command mode)
Of course, you could also use the above batch file and run it as a service with an elevated user. If you did this, and did not call WinSCP from the batch file, you would have to make the batch file cont. loop, but you could do this by putting
If you wanted to go this route you could change the .bat file to service with these instructions:
Or, you could change your .bat to an .exe and then run it as a service using
Just an additional thought of how you could use the above batch file – if you only wanted one copy of the batch file running under an elevated rights user as a service to monitor connections for all user sessions, and close down WinSCP for those users who have disconnected in WinSCP.
GOTO BEGIN
in the last line of the batch file. The drawback with running it as one service is that it will constantly have a small resource pull, rather than just when it is called is association with a new execution of WinSCP.
If you wanted to go this route you could change the .bat file to service with these instructions:
Or, you could change your .bat to an .exe and then run it as a service using
SC.EXE
:
- https://superuser.com/questions/868340/how-can-i-convert-a-windows-batch-script-to-a-exe
- https://stackoverflow.com/questions/3582108/create-windows-service-from-executable
Just an additional thought of how you could use the above batch file – if you only wanted one copy of the batch file running under an elevated rights user as a service to monitor connections for all user sessions, and close down WinSCP for those users who have disconnected in WinSCP.