Search code examples
ms-accessbatch-filemapped-drivecontrol-m

Control-M job not ending after .bat finishes


I have a .bat file that maps a network drive, runs an MS Access program then deletes the mapped drive and exits. When I run it through Control-M the .bat runs and finishes but the job in Control-M never ends. I have tried multiple things to end the file to send Control-M an exit code but nothing seems to be working. Below is the code:

@echo off
net use w: [path]
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "Y:\MSAccess.mdb"
net use w: /delete

After this code I have tried the following commands:
exit
_exit 0
timeout /T 10

No matter what I try Control-M never seems to know that the job has finished. The sysout from Control-M also does not show any kind of exit code being sent back.


Solution

  • After some more testing and investigation the issue was happening earlier in the .bat. The MS Access database was never being opened and run. Therefore since it was never starting it was never ending or sending an error code. I am researching why the MS Access database was not running now, which may lead to another question.