sysExecute

Version 24.3.9106


sysExecute


Executes a program or command.

必要なパラメータ

  • name: The name of the command or program to execute.

オプションのパラメータ

  • arguments: The space-delimited set of command-line arguments for the command or program (for example, <arc:set attr="executable.arguments" value="arg1 arg2 arg3"/>).
  • argarray#: An array of arguments to supply to the command or program. The array is built by creating an argarray# entry for each index (argument) that you want (see the examples below).
  • directory: The directory to start the command or program in. The default value is ..
  • timeout: The maximum amount of time (in seconds) to wait for the command or program. Use -1 to indicate no timeout. The default value is 60.
  • waitforoutput: Whether to wait for the output of the command or program. The default value is true.

アウトプット属性

  • sys:output: The output of the command or program.
  • sys:error: The error output, if any, of the command or program.

.NET

<!-- Creating an out item to hold output data -->
<arc:set attr="out.data" value=""/>
<!-- Creating an input item, 'executable' and assigning input parameters -->
<arc:set attr="executable.name" value="C:\\temp\\foo.bat" />
<!-- Creating an array of arguments that will be passed into the command or program -->
<arc:set attr="executable.argarray#1" value="arg1"/>
<arc:set attr="executable.argarray#2" value="arg2"/>
<arc:set attr="executable.argarray#3" value="arg3"/>
<!-- Calling the operation, passing in the input item and setting an output item -->
<arc:call op="sysExecute" in="executable" out="results">
  <!-- Populating the data attribute of the out item -->
  <arc:set attr="out.data" value="[results.sys:output]" />
</arc:call>
<!-- Setting the filename of the out item and pushing it as an output file -->
<arc:set attr="out.filename" value="echo.txt"/>
<arc:push item="out"/>

The batch file called here is programmed to output Hello world along with a list of the arguments that were passed in. The output of this script (echo.txt) looks like this:

Hello world.
The first argument is arg1
The second argument is arg2
The third argument is arg3

Linux

<!-- Creating an out item to hold output data -->
<arc:set attr="out.data" value=""/>
<!-- Creating an input item, 'executable' and assigning input parameters -->
<arc:set attr="executable.name" value="bash" />
<arc:set attr="executable.arguments" value="/mnt/c/scripts/helloworld.sh lion tiger bear" />
<!-- Calling the operation, passing in the input item and setting an output item -->
<arc:call op="sysExecute" in="executable" out="results">
  <!-- Populating the data attribute of the out item -->
  <arc:set attr="out.data" value="[results.sys:output]" />
</arc:call>
<!-- Setting the filename of the out item and pushing it as an output file -->
<arc:set attr="out.filename" value="echo.txt"/>
<arc:push item="out"/>

The batch file called here is programmed to output hello linux world along with a list of the arguments that were passed in. The output of this script (echo.txt) looks like this:

hello linux world
The first argument is lion
The second argument is tiger
The third argument is bear