Element Details: Procedure.RunShellCommand
 Back


Available in: Logi Info Source code name: Procedure.RunShellCommandIntroduced in: 12.6

Run an operating system command or application, optionally passing in command line parameters.

Ensure the shell command has no prompts. Prompts will cause the command to hang.

For the StandardOutputFilename and ErrorOutputFilename attributes, take care to not have filenames which may be in use when there are multiple simultaneous requests.

Some Windows commands do not have a filename, they are accessible via the Command Shell. For these, set the Filename attribute to "cmd". For ShellCommandParamters, set "/C " then the full command line. An example which copies files:

<Procedure
Type="RunShellCommand"
Filename="cmd"
ID="procCopyFiles"
ShellCommandParameters="/C COPY *.* c:\temp /Y"
/>

Note that in the example the /Y prevents the COPY command from hanging the process with a prompt.

There are Procedure tokens available after running the Procedure.

@Procedure.myProcedureID.ExitCode returns the process' exit code.

@Procedure.myProcedureID.TimedOut~ is True if the process did not complete because of a timeout. Otherwise it is False.

@Procedure.myProcedureID.StandardOutput~ is the process' standard console output.

@Procedure.myProcedureID.ErrorOutput~ is the process' error output stream. Usually blank when there are no errors.



ATTRIBUTES

Click attribute Name to drill down for more information.

NamePossible ValuesDescription
ErrorOutputFilename
UserDefined
ErrorOutputFilename may be used to specify a file location for storing error output from a shell command. Alternatively, leave this value blank to access the error output with token @Procedure.myProcedureID.ErrorOutput~.
Filename
UserDefined
A physical, file system path and filename.
ID
UserDefined
(Required) The ID attribute is a pervasive attribute that uniquely identifies an element within a definition file. The ID needs to be a unique value within the definition.
ShellCommandParameters
UserDefined
The parameter string for the shell command. This is the part of the command which goes after the actual command name.
StandardOutputFilename
UserDefined
StandardOutputFilename may be used to specify a file location for storing a shell command's "standard" output. That is the output typically seen when running a shell command from a command prompt. Alternatively, leave this value blank to access the standard output with token @Procedure.myProcedureID.StandardOutput~.
Timeout
UserDefined
The length of time, in seconds, to wait for an action to complete before a timeout error occurs. If the time is set to 0, then the job will wait until the request completes.
WorkingDirectory
UserDefined
The working directory to be used for the shell command.



PARENT ELEMENTS

Click element to drill down for more information.

If Error
Procedure.File Exists
Procedure.Folder Exists
Procedure.If
Procedure.Run Datalayer Rows
Procedure.Run DataTable Rows
Procedure.Switch Case
Procedure.Switch Else
Task


CHILD ELEMENTS

Click element to drill down for more information.

If Error


 Back to top


 Chart Debug