Command
This feature allows you to run executable programs. To run shell commands, batch/script files, you will need to launch the appropriate shell as an executable. Then use the shell to run the command.
Command Line
Executables: to run an executable, use the full path to
the executable. Example:
c:\winnt\notepad.exe
To enter a commandline parameter to pass to your executable, enter a space
between the path and the parameter. Leave spaces between any subsequent
parameters. Example:
c:\test\myexe.exe par1 par2
You can use commandline arguments instead of a single commandline as
follows:
command<arg>parameter1<arg>parameter2<arg>parameter3
(i.e. separate the initial command and each argument of the commandline by
<arg> )
Example:
c:\test\myexe.exe<arg>test1<arg>test2<arg>test3
NOTE::
Java no longer supports embedded quotes within the command line
(java 1.6.45 and later).
If the path to your executable includes spaces, it was normally
embedded in quotes. Unfortunately, this is no longer supported in
java. Example: The following commandline will fail in java 1.6.45
and later.
"c:\program files\myexe.exe" par1 par2
The task will detect this error and try and parse the commandline into
arguments:
c:\program files\myexe.exe<arg>par1<arg>par2
If the task fails to parse your commandline arguments correctly, please use the <arg> format described above.
For Shell commands, and batch or script files: the syntax required vary depending on operating systems. Examples of batch commands for Windows, Unix, and Mac OS X are listed at the end of this section.
This field also supports dynamic variables.
For example, to launch a batch file, and pass it the current time, use:
c:\data\test.bat $%DATE::hh:mm:ss%$
Working Directory
The working directory is required for your program, command or script to
run correctly. This is very important if the program or script uses
relative paths to access files.
Environment Variables
This is an array of strings. Each element of this array has environment
variable settings in format name=value. You should separate each
name=value pair by a delimiter character. You can choose the delimiter to
separate each element. The default delimiter is ^. If any of
your variable name=value pairs contains the ^ character, then you should
set another character as your delimiter. The delimiter cannot be "=" or
any other character that appears in your name=value pairs.
Example of correctly formatted environment variables on windows systems:
PATH=c:\test;c:\test2;c:\test3^TEMP=c:\temp
This field also supports dynamic variables.
For example, to launch a batch file and set the variable 'CUSTOM_DATE',
use:
CUSTOM_DATE=$%DATE::Qqq dd, YY HH:mm:ss am_pm%$
This will set the variable CUSTOM_DATE in the batch file to: Aug 21, 2002
10:21:23 AM etc..
Termination Time
The termination time is the maximum time that your program or script can
run. The task will terminate your program, if it is still running,
after the maximum allowed time. Enter a value = 0, if you do not
want to terminate your program. In this case, the task will wait
indefinitely, for your task to finish.
Polling interval
While your program or script is running, the task continuously polls your
program/script. The task will check if the program has completed. The task
will obtain the Exit Code value, when your program exits. You can
select the polling interval (default = 15 seconds). The minimum interval
is 1 second. We recommend using 15 seconds.
1) Executable programs:
Command line = c:\windows\notepad.exe
Working Directory = c:\windows
2) Batch files (uses command.com, located usually in c:\windows or in
c:\)
Command line = c:\windows\command.com /c c:\test\test.bat
Working Directory = c:\test
NOTE: you can also try and run batch files, just like an executable,
depending on your system setup.
Command line = c:\test\test.bat
3) Shell commands (uses command.com, located usually in c:\windows or in
c:\)
Command line = c:\windows\command.com /c set c:\test\set.txt
Working Directory = c:\windows
(this example will output all your environment variables to the file
set.txt)
Unix (Solaris, Linux, MacosX or other)
To run shell commands or scripts, you will need to launch the appropriate
shell as an executable. Then use the shell to run the command.
Example to run the script 'myscript' from the /home/name directory, using
the 'sh' command interpreter:
Commandline = sh myscript
Working Dir = /home/name
To see the options available to run your script, use man sh, man csh, or man bash.
Another option to run a shell script or command, is to use the Telnet Task. Using the Telnet task, login to the local system, 'cd' to the desired director, using a first telnet command. Then run the shell script or command, using a second telnet command.
1. AppleScripts: Use the 'osascript' command to launch
your AppleScripts
Example:
Commandline = /usr/bin/osascript
/user/Name/YourScript.scpt
Working Dir = /user/Name
2. Launch Applications or files: You can also use the 'open'
command in MacOS X, to open a document or application
Example:
Command Line = open Stickies.app
Working Dir = /Applications
3. Command line: To run shell commands or
scripts, please see the section on Unix above.