Command Line/Command File Commands
Command Line Commands
When TwinCAT PLC Control is started, you can add commands in the command line which will be asserted during execution of the program. These commands start with a "/". Capitalization/Use of small letters is not regarded. The commands will be executed sequentially from the left to the right.
Command |
Description |
---|---|
/debug |
|
/online |
|
/run |
|
/show ... |
Settings for the TwinCAT PLC Control frame window can be made. |
/show hide |
The window will not be displayed, it also will not be represented in the task menu. |
/show icon |
The window will be minimized in display. |
/show max |
The window will be maximized in display. |
/show normal |
The window will be displayed in the same status as it was during the last closing. |
/out <outfile> |
All messages are displayed in the message window and additionally are written in the file <outfile>. |
/cmd <cmdfile> |
After starting the commands of the <cmdfile> get executed. |
The input of a command line is structured like this:
"<Path of the TwinCAT PLC Control-Exe file >""<Path of the project>"/<Command1>/<Command2>...
Example for a command line:
"D:\dir1 TwinCAT PLC Control" "C:\projects\ampel.pro" /show hide /cmd command.cmd
The project ampel.pro gets opened, but no window opens. The commands included in the command file command.cmd will be executed.
Command File (cmdfile) Commands
See the following table for a list of commands, which can be used in a command file (<cmdfile>). The command file you can call by a command line (see above). Capitalizing/Use of small letters is not regarded. The command line will be displayed as a message in the message window and can be given out in a message file (see below). Additionally to the command a "@" is prefixed. All signs after a semicolon (;) will be ignored (comment).
Commands of the online menu:
Commands | Description |
---|---|
online login | Login with the loaded project ('Online Login') |
online logout | Logout ('Online' 'Logout') |
online run | Start of the application program ('Online' 'Run') |
online sim | Switch on of simulation mode 'Online' 'Simulation') |
online sim off | Switch off of simulation mode ('Online' 'Simulation') |
Commands of the file menu:
Commands | Description |
---|---|
file new | A new project is created ('File' 'New'). |
file open <projectfile> | The project <projectfile> will be loaded ('File' 'Open'). |
file close | The current project will be closed ('File' 'Close'). |
file save | The current project will be stored ('File' 'Save'). |
file saveas <projectfile> | The current project will be saved with the file name <projectfile> ('File' 'Save as'). |
file quit | TwinCAT PLC Control will be closed ('File' 'Exit'). |
Commands of the project menu:
Commands | Description |
---|---|
project compile | The current project will be compiled by "Rebuild all" ('Project' 'Rebuild all'). |
project check | The current project will be checked ('Project' 'Check'). |
project build | The current project will be built ('Project' 'Build'). |
project import <file1> ... <fileN> | The files <file1> ... <fileN> get imported into the current project ('Project' 'Import'). |
project export <expfile> | The current project will be exported in the file <expfile> ('Project' 'Export') |
project expmul <expfile> | Each object of the current project will be exported in an own file, which gets the name of the object. |
Commands for the control of the message file:
Commands | Description |
---|---|
out open <msgfile> | The file <msgfile> opens as message file. New messages will be appended. |
out close | The currently shown message file will be closed. |
out clear | All messages of the currently opened message file will be deleted. |
Commands for the control of messages:
Commands | Description |
---|---|
echo on | The command lines will be displayed as messages. |
echo off | The command lines will not be displayed as messages. |
echo <text> | <text> will be displayed in the message window. |
Commands for the control of replace of objects respectively for the control of files for import, export, replace:
Commands | Description |
---|---|
replace ok replace yes | Replace |
replace no | Do not replace |
replace noall | Replace none |
replace yesall | Replace all |
Commands for the control of the default parameters of dialogs:
Commands | Description |
---|---|
query on | Dialogs are displayed and need user input. |
query off ok | All dialogs respond as if the user had clicked on the 'OK' button. |
query off no | All dialogs respond as if the user had clicked on the 'No' button. |
query off cancel | All dialogs respond as if the user had clicked on the 'Cancel' button. |
Debug Command:
Commands | Description |
---|---|
debug | corresponds to the command "/debug" in the command line |
Command for calling command files as subroutines:
Commands | Description |
---|---|
call <parameter1>... <parameter10> | Command files are called as subroutines. Up to ten parameters can be consigned. In the subroutine called you can access the parameters using $0 - $9. |
Commands for setting the libraries:
Commands | Description |
---|---|
dir lib <libdir> | <libdir> is set as library directory |
dir compile <compiledir> | <compiledir> is set as directory for compile files |
Commands for setting a delay time concerning execution of the CMDFILEs:
Commands | Description |
---|---|
delay 5000 | Waiting 5 Seconds. |
Commands for control of the Watch and Recipe Manager:
Commands | Description |
---|---|
watchlist load <file> | The watch list saved in <file> will be loaded and the appropriate window will be opened ('Extras' 'Load Watch List'). |
watchlist save <file> | Saves the current watch list in <file> ('Extras' 'Save Watch List'). |
watchlist set <text> | A previous loaded watch list gets the name <text> ('Extras' 'Rename Watch List'). |
watchlist read | The values of the watch variables are updated ('Extras' 'Read Recipe'). |
watchlist write | The values of the watch list are written to the watch variables ('Extras' 'Write Recipe'). |
Commands for linking libraries:
Commands | Description |
---|---|
library add <library file1> <library file2> .. <library fileN> | Attaches the specified library file to the library list of the currently open project. If the file path is a relative path, the library directory entered in the project is used as the root of the path. |
library delete [<library1> <library2> .. <libraryN>] | Deletes the specified library, or (if no library name is specified) all libraries from the library list of the currently open project. |
Commands for copying objects:
Commands | Description |
---|---|
object copy <source project file> <source path> <target path> | Copies objects from the specified path of the source project file to the target path of the already opened project. |
Commands system calls:
Commands | Description |
---|---|
system <command> | Carries out the specified operating system command. |
Commands for online modus:
Commands | Description |
---|---|
Reset | If you have initialized the variables with a specific value, then this command will reset the variables to the initialized value. |
ResetAll | This command resets all variables including the persistent ones to their initialization values and erases the user program on the controller. |
CreateBootproject | With this command the compiled project is set up on the controller. |
ChooseRuntime <text> | A specific Runtime System can be chosen. For <text> use the Net-Id and seperated with ":" the port number. |
Example of a command file:
A command file like shown below will open the project file ampel.pro, will then load a watch list, which was stored as w.wtc, will then start the application program and write - after 1 second delay - the values of the variables into the watch list watch.wtc (which will be saved) and will finally close the project.
file open C:\work\projects\ampel.pro
query off ok
watchlist load c:\work\w.wtc
online login
online run
delay 1000
CreateBootproject
watchlist read
watchlist save c:\work\watch.wtc
online logout
file close