Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, is there a way to determine if a certain batch file is being executed and if the execution has completed successfully?

Thanks

Replies are listed 'Best First'.
Re: Running or not running
by Abigail-II (Bishop) on May 12, 2004 at 14:00 UTC
    is there a way to determine if a certain batch file is being executed
    ps
    if the execution has completed successfully
    Check the exit value.

    Abigail

Re: Running or not running
by perlinux (Deacon) on May 12, 2004 at 14:18 UTC
    If you're executing your batch from within a Perl script with system(), you can control your exit status. If system() returns 0 it's all ok...if this is not your situation, post other infos

      Yes, I will be executing batch files from within Perl, however these batch files or bundles are all silent software installation programs. Some of these batch file (we call them 'GO' scripts here) require some sort of user intervention, but some do not. I want to differentiate between the one that do require manual intervention to the ones that do not. For example :

      I might have a batch bundle that is called office2003.go. Inside this batch bundle I will have things like msword.go, excel.go, project.go....etc. when I click on this batch file, a progress bar appears on the screen and a message informing the tasks the go scripts is doing (in this case installing the whole office software suit).

      On the other hand, I might have another batch bundle, which is called something like Autoscore.go that installs the Autoscore software. However at some point during the installion, another dialog window might appear requesting further information or it will simple fail.

      This is basically what I am trying to achieve, is to distinguish between Go scripts that installs fully without user intervention and other go scripts that either fail out right or will never install untill maual intervension is provided.

      If I do this manually it would probably take me months to finish of because I have thousands of these applications or batch bundles

      I suppose a good place for me to start would be if I can write a script that runs a batch file and informs whether the batch execution has completed successfully or not.

      Mind you some batch file could take few seconds to install and other batch bundles could take hours. so I suppose I have tp rogram some sort of timing threshold knowing that the longest batch bundle would not take more that 6 hours to install.

      Thanks
        If you're starting the .go files from within your Perl script, you should be able to start them up with system, and when that function returns the program is complete.
Re: Running or not running
by aquarium (Curate) on May 12, 2004 at 14:01 UTC
    are you calling other programs (batch files) from one master batch program?....in which case check ERRORLEVEL windows environment variable. type HELP IF at commandline. if it's a standalone batch program...use "ECHO here i am" or "ECHO here i am >test.txt" to see that your program runs.

      Just a correction.

      ERRORLEVEL is not an environment variable. It's just a keyword known to the IF statement of the shell.