system() function on Windows OS

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
3 posts • Page 1 of 1
johna_ssa
Posts:21
Joined: Wed Jan 28, 2015 6:14 pm

system() function on Windows OS

Post by johna_ssa »

Is there more documentation on the system() function as it applies to Windows OS? Here’s all that I can find in the help files:

• system("start /b program") starts without DOS window in the background under Windows.
• system("cmd /c program") starts synchronously but in a DOS window
• system("start cmd /c program") starts asynchronously but in a DOS window. Thus, they can only be used under Windows.
• Windows programs not in the path can be launched with system ("cmd /c start ")!

This information is rather vague. For instance, I would like to run a command/program in the background (without a window) synchronously. How do I do that?

I assume “cmd” launches the program in a dos window. What’s the difference between “/b” and “/c”? And why is "start cmd /c program" different from "cmd /c start "? Is the order of the keywords really flexible and important? What exactly does the "start" keyword do? What's the difference between "background" and "synchronous/asynchronous"?

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: system() function on Windows OS

Post by kilianvp »

START runs asynchronously (the batch file executes the next line immediately).
CMD /C runs synchronously (the batch file does wait until the called command was finished).

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: system() function on Windows OS

Post by leoknipp »

The system() command in WinCC OA gives you the possibility to start an program, batch file, ....
The syntax used for the command depends on the command/program you want to start.
You can also start a program by addressing the absolute path: system(/);
If the directory where the program is located is included in the PATH environment you can simlpy call the program: system();

Best Regards
Leopold Knipp
Senior Support Specialist

3 posts • Page 1 of 1