OpSys
Use this command to run an executable or a batch program issuing commands to an executable.
For example, OPSYS "\"C:\Program Files\Main files\run.exe\" parameter1 parameter2" resolves to running "C:\Program Files\Main files\run.exe" with parameter1 and parameter2 on the command line.
The error code for the procedure is available to the user by examining the value of OPSYSCODE, which is a variable returned whenever OPSYS is run (a value of 0 indicates that the command ran successfully).
The permitted program paths for the OPSYS command are specified in the lv_af.cfg file found in the working directory of the lv_af.exe. While events are running, the lv_af.exe will look for the lv_af.cfg in the working directory of the Data Server. For example, C:\Longview\LVCPM\DataServers\LVCPM.
The working directory of the Data Server can be specified in the lvsrvr.cfg file under the WORK_DIRECTORY parameter.
To change the permitted program paths, open the lv_af.cfg file in your preferred text editor, and modify the PERMITTED_OPSYS_PATH statement. There are no path restrictions if the lv_af.cfg file does not exist or if the statement value is blank. Lines in the lv_af.cfg file cannot surpass 4094 characters. Separate multiple paths with a semicolon ( ; ). For example:
PERMITTED_OPSYS_PATH = C:\AF\App_Logic;C:\tmp;C:\lv\source
Syntax
OPSYS [NOWAIT] "Command"
where:
- NOWAIT is an optional parameter that indicates that the procedure should continue during the execution of the OPSYS command. The default is for the procedure to wait until the OPSYS command has completed execution.
- "Command" is the name of the command to execute, including any parameters and, if necessary, the path, enclosed in double quotation marks. For security reasons, the command cannot list a path that contains directory traversal characters ( . . ). For example, OPSYS "\"C:\temp\..\run.exe\" returns a security violation error.
Note: To include double quotation marks in the character string, precede the interior double quotation marks with a backslash ( \ ).
Note: Windows batch file names, and the paths to them, referenced in the command cannot contain spaces.
Syntax example
OPSYS mybatch.bat