<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Errorlevel or return code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/865c3a184c/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/865c3a184c/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/865c3a184c/</id><updated>2020-02-27T14:51:06.845000Z</updated><subtitle>Recent posts to Errorlevel or return code</subtitle><entry><title>Errorlevel or return code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/865c3a184c/?limit=25#7fbc" rel="alternate"/><published>2020-02-27T14:51:06.845000Z</published><updated>2020-02-27T14:51:06.845000Z</updated><author><name>chab</name><uri>https://forge.codesys.com/u/chab/</uri></author><id>https://forge.codesys.come3857902acbea3b933055b646b879276ab9297f7</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I replaced &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;sys&lt;/span&gt;.&lt;span class="k"&gt;exit&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;with&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;system&lt;/span&gt;.&lt;span class="k"&gt;exit&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And it is working successful. The batch command retrieves the correct errorlevel.&lt;/p&gt;
&lt;p&gt;Thank you for your help.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Errorlevel or return code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/865c3a184c/?limit=25#8625" rel="alternate"/><published>2020-02-27T14:51:06.261000Z</published><updated>2020-02-27T14:51:06.261000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comb01c19690680a616d45b145bf7544df147de56e4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; M.Schaber&lt;/p&gt;
&lt;p&gt;Hi, Edwin,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Edwin hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Does CoDeSys return an errorlevel, when using --runscript?&lt;br/&gt;
I use (in a batch file):&lt;br/&gt;
&lt;code&gt;"%CoDeSysPath%\CoDeSys.exe" --profile="CoDeSys V3.5 Patch 4" --noUI --runscript="script1.py"
echo %errorlevel%&lt;/code&gt;The errorlevel is 0 always. Even when using sys.exit (4) in the script.&lt;br/&gt;
How can I get the return code from the script running in CoDeSys, into my batch file?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you use system.exit(4), it should work.&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="http://jira.3s-software.com/browse/CDS-30366" rel="nofollow"&gt;CDS-30366&lt;/a&gt; in our tracker, so this will be fixed eventually.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Errorlevel or return code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/865c3a184c/?limit=25#43dd" rel="alternate"/><published>2020-02-27T14:51:04.691000Z</published><updated>2020-02-27T14:51:04.691000Z</updated><author><name>chab</name><uri>https://forge.codesys.com/u/chab/</uri></author><id>https://forge.codesys.comc5a5ff0b344cb2e30bb2f965928a663572ffd1d4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Does CoDeSys return an errorlevel, when using --runscript?&lt;/p&gt;
&lt;p&gt;I use (in a batch file):&lt;br/&gt;
```&lt;/p&gt;
&lt;p&gt;"%CoDeSysPath%\CoDeSys.exe" --profile="CoDeSys V3.5 Patch 4" --noUI --runscript="script1.py"&lt;br/&gt;
echo %errorlevel%&lt;/p&gt;
&lt;p&gt;```The errorlevel is 0 always. Even when using sys.exit (4) in the script.&lt;/p&gt;
&lt;p&gt;How can I get the return code from the script running in CoDeSys, into my batch file?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>