<< to CrossControl homepage

Support & Service Center

Calling Operating System commands from CoDeSys

Printer-friendly versionPrinter-friendly versionPDF versionPDF version

There are several ways to execute a OS system command from your CODESYS application.

The preferred solution is using CODESYS built-in function, SysProcessExecuteCommand. However, as a second option for older runtime versions where SysProcessExecuteCommand is not implemented, ShellCommand_System from the CCAux library described below could be used.



To use the SysProcessExecuteCommand you need to add the "SysProcess Implementation" library to your project.

The official documentation is to be found in the CODESYS documentation/help section. SysProcess Implementation Library Documentation

To execute a command you set the pszComand (string) variable to your command.

If you want to listen to StdOut you should use SysProcessExecuteCommand2 that has a pszStdOut (string pointer) variable returning the output from StdOut.

Example archive of this method attached this Knowledge Base article



Within CCAux for CoDeSys, we provide a function ShellCommand_System which can be used to call externals programs from CoDeSys. Please see the attached image.

This method is implemented since CCAux version However, this call are not able to listen to the return information (StdOut)

The function ShellCommand_System will be deprecated and for all new implementation SysProcessExecuteCommand should be used.



System Call in CCAux