Using the START command in a .bat script

Paul Watson (101 posts)
May 23, 2018 12:08 PM
Accepted Answer

I have a .bat script which uses the START command on multiple files. It will wait until all of the started scripts have ended. The code is running as expected from the command line.

However, when I run under adTempus 4.3, it appears that it does not wait.

Is there any problem or issue with using the START command in a .bat script under adTempus?

FOR /F "usebackq tokens=*" %%f IN (`DIR /B "*.txt"`) DO (
    SET "FN=%%~f"
    SET "FZ=%%~zf"
    ECHO>>"%LOGFILE%" Generating file for "!FN!"
    START "Counting !FN!" "%ComSpec%" /C "9^>"%LOCKBASENAME%-!FN!.lock" "%PHS_DMEXPRESS_EXE%" /RUN "%PHS_CONFIG_HOME%\bin\wc-frc.dxt" ^>"..\Counts\%%~nf_frc.txt" 2^>NUL ^&^& EXIT"
)

:WaitForIt
TIMEOUT /T 15 >NUL
>NUL 2>&1 DEL "%LOCKBASENAME%*"
IF EXIST "%LOCKBASENAME%*" (GOTO WaitForIt)

Also, in the adTempus Console, selecting Help > Contents goes to an unknown page. The Arcana web site changes look good, but was this connection lost in translation?

Bill Staff (599 posts)
May 24, 2018 06:51 AM
Accepted Answer

Thanks mentioning the broken help links. That has been fixed.

There are no known issues with using the start command. I tested a similar batch file and it worked fine, except that the timeout command fails with this error:

ERROR: Input redirection is not supported, exiting the process immediately.

This happens when you use the Capture Console setting for the step, because Capture Console redirects stdin and stdout for the batch file, and the timeout program doesn't like this. You'll need to use something else for the delay. There are ways to do it with waitfor, or you can use a simple utility that sleeps. We have one if you need it (I think it used to get installed with adTempus but not any more).

But that's not what's causing your problem, because that just makes the timeout fail and the batch file goes into a tight loop and sucks up all your CPU time.

If it's not waiting, then either your lock file isn't getting created, or something else is failing, causing your outer batch file to abort.

You need to use Capture Console to see what's going on. Of if Capture Console causes problems, make the job run interactively so you can see what it's doing (see this article for a description of how to do this; note that you will need to be able to log in under the account that the job runs under, and that account will need permission to log in to adTempus and run the job).


Paul Watson (101 posts)
May 24, 2018 07:16 AM
Accepted Answer

Thanks for your reply. This is totally user error. My PHS_CONFIG_HOME variable was pointing to an older version of the configuration scripts which did not contain the `wc-frc.dxt` program. 

"%PHS_CONFIG_HOME%\bin\wc-frc.dxt"

Once I pointed PHS_CONFIG_HOME to a more current version, it worked as expected. Sorry to waste your time on my errors.


Replies are disabled for this topic.