Reputation: 380
I have made a bat file to run a jar file. Whenever a user closes cmd using the close button, I want event should be logged. How do I capture this?
Upvotes: 0
Views: 214
Reputation: 6669
Only way I can think to do this is to run a monitor script:
@start /WAIT cmd.exe batch.cmd args
@rem Do whatever logging needs to happen here.
Depending on how you start the monitor, you can arrange to hide that from the user so they can't kill it. Take a look at start /?
for the range of options you can use.
Upvotes: 1