📖HomeBack Sometimes you might need to perform some action on a machine, or start an application based on the state of the ClearSCADA server.
The following batch file provides a simple example on how to perform some action based on the status of the server.
@echo offFor /f "Tokens=*" %%i in ('scxcmd showstate') do set SERVERSTATE="%%i"if %SERVERSTATE% EQU "Main" goto IsMaingoto NotMain:IsMainecho This server is the MAINgoto End:NotMainecho This server is not the MAIN:End
The above code assumes that the scxcmd executable is in the path. If it isn't then either place this batch file in the same directory as scxcmd, add the installation directory to the path or modify the code above to contain the full path to scxcmd.