0

We have a .CMD script that we are triggering from Control-M.

A main.cmd is being called from Control-M. This script is run as 'accnt_svc' service account which we also configured in Control-M. Prior to setting up in Control-M, we testing this running fine when ran from command prompt (as administrator) and via Windows Task Scheduler being run as the 'acct_svc' service account.

When running in Control M, the log shows error saying a subscript (say sub.cmd is being called from main.cmd) saying the sub.cmd is invalid.

We checked the permissions and they both have the same settings.

We tried another script, this time we created a wrapper which 'calls' the main script. This worked fine. Please check following wrapper:

SET V_CMDDRV=E:
%V_CMDDRV%
CD %V_CMDDIR%
CALL  CALL %V_CMDDIR%\main.cmd

When we create a Main_Wrapper.cmd calling the main.cmd this works fine.

May I know why Control-M behaves this way?

Thanks

Sayali Sonawane
  • 12,289
  • 5
  • 46
  • 47
Toti Godz
  • 1
  • 2
  • Have you captured the output of running this wrapper? In what directory is it on E:? Please post the output and error message using copy/paste. – lit Sep 20 '16 at 22:53
  • Hi, the scripts are located in drive E. The Output is as follows `E$\\main.cmd 'sub.cmd' is not recognized as an internal or external command, operable program or batch file. The syntax of the command is incorrect. Job Object statistics ==================== Total User CPU Time: 0.016 second` – Toti Godz Sep 20 '16 at 23:34
  • The error output should be placed into the question and formatted to be readable. Do you have any output from the `CD %V_CMDDIR%` command? What directory does it report being in? In what directory is `sub.cmd` located? `E$\\main.cmd` looks suspicious. Is that what Control-M does for other working jobs? – lit Sep 21 '16 at 00:48

1 Answers1

0

When issuing a command via Control-M it will by default run from your run as users home directory. From the output you've attached it looks like main.cmd might need to be run from E: instead of the %HOMEPATH% of the acct_svc service account.

Jasper
  • 192
  • 8