Notify when batchfile ends
-
- StarLounger
- Posts: 56
- Joined: 24 Jan 2012, 21:48
Notify when batchfile ends
I have a batchfile which takes a while to run. It's called with a shell command. Is there a way to obtain an event/notification to say when the batchfile has ended. I tried putting DoEvents after calling my batchfile, followed by a messagebox, but the messagebox appeared way before the batchfile had finished. Any ideas? I Don't always know how long the batchfile will run for to use a timer. ?? Thanks
-
- PlatinumLounger
- Posts: 5408
- Joined: 24 Jan 2010, 08:33
- Location: A cathedral city in England
Re: Notify when batchfile ends
What sort of event/notification are you hoping for? In pure BATch you're limited to using an ECHO command, or running something like MsgBox, or terminating with EXIT /B 1 (if something can inspect the errorlevel/return code), or setting up a flag file that something else can inspect. BLAT (among other programs) can be used to send yourself an email.
Probably more appropriate for a VBA person?
After a little more thought...
In BATch there is a difference between running
Seems to me that you need to set the BATch file off and wait for it to terminate!
Probably more appropriate for a VBA person?
After a little more thought...
In BATch there is a difference between running
- BATchfile.bat
- CALL BATchfile.bat
- START " " /WAIT BATchfile.bat
Seems to me that you need to set the BATch file off and wait for it to terminate!
John Gray
"(or one of the team)" - how your appointment letter indicates you won't be seeing the Consultant...
"(or one of the team)" - how your appointment letter indicates you won't be seeing the Consultant...
-
- StarLounger
- Posts: 56
- Joined: 24 Jan 2012, 21:48
Re: Notify when batchfile ends
Thanks John for your help. I did not know a messagebox can be put in a batchfile, so I will disable controls on my form prior to the batchfile being called, and use a messagebox at the end of the batchfile commands, which after clicking ok I can re-enable form controls.
I will also look into START " " /WAIT BATchfile.bat to see if a better option still exists. It's really to stop people doing anything else while the batchfile is working, telling them something is happening and resuming user freedom afterwards.
I will also look into START " " /WAIT BATchfile.bat to see if a better option still exists. It's really to stop people doing anything else while the batchfile is working, telling them something is happening and resuming user freedom afterwards.
-
- PlatinumLounger
- Posts: 5408
- Joined: 24 Jan 2010, 08:33
- Location: A cathedral city in England
Re: Notify when batchfile ends
The MsgBox I referred to was an external utility program called by the BATch file!
John Gray
"(or one of the team)" - how your appointment letter indicates you won't be seeing the Consultant...
"(or one of the team)" - how your appointment letter indicates you won't be seeing the Consultant...
-
- StarLounger
- Posts: 56
- Joined: 24 Jan 2012, 21:48
Re: Notify when batchfile ends
Hello John, I managed to put:
msg * Operation Finished at the end of my batchfile commands.
That then frees the user to carry on once the messagebox is clicked. Prior to going into the batchfile I have a notice displayed (label) saying please wait!!
Seems to have got me sorted John, so thanks again
msg * Operation Finished at the end of my batchfile commands.
That then frees the user to carry on once the messagebox is clicked. Prior to going into the batchfile I have a notice displayed (label) saying please wait!!
Seems to have got me sorted John, so thanks again
-
- PlatinumLounger
- Posts: 5408
- Joined: 24 Jan 2010, 08:33
- Location: A cathedral city in England
Re: Notify when batchfile ends
Well done! Most places have disabled the MSG * command because of 'misuse'...!
John Gray
"(or one of the team)" - how your appointment letter indicates you won't be seeing the Consultant...
"(or one of the team)" - how your appointment letter indicates you won't be seeing the Consultant...
-
- StarLounger
- Posts: 56
- Joined: 24 Jan 2012, 21:48
Re: Notify when batchfile ends
Thanks to you John, if you had not mentioned message boxes I would still be scratching my head.