Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Errorlevel or return code

chab
2012-08-02
2012-08-20
  • chab - 2012-08-02

    Does CoDeSys return an errorlevel, when using --runscript?

    I use (in a batch file):
    ```

    "%CoDeSysPath%\CoDeSys.exe" --profile="CoDeSys V3.5 Patch 4" --noUI --runscript="script1.py"
    echo %errorlevel%

    ```The errorlevel is 0 always. Even when using sys.exit (4) in the script.

    How can I get the return code from the script running in CoDeSys, into my batch file?

     
  • Anonymous - 2012-08-17

    Originally created by: M.Schaber

    Hi, Edwin,

    Edwin hat geschrieben:
    Does CoDeSys return an errorlevel, when using --runscript?
    I use (in a batch file):
    "%CoDeSysPath%\CoDeSys.exe" --profile="CoDeSys V3.5 Patch 4" --noUI --runscript="script1.py" echo %errorlevel%The errorlevel is 0 always. Even when using sys.exit (4) in the script.
    How can I get the return code from the script running in CoDeSys, into my batch file?

    If you use system.exit(4), it should work.

    CDS-30366 in our tracker, so this will be fixed eventually.

     
  • chab - 2012-08-20

    I replaced

    sys.exit(4)
    

    with

    system.exit(4)
    

    And it is working successful. The batch command retrieves the correct errorlevel.

    Thank you for your help.

     

Log in to post a comment.