The taskrun utility sets up the standard input for the specified command, runs the command, and places the output of that command in a user-specified location. taskrun was designed primarily for use with at, batch, and wts so that output and errors produced by tasks scheduled with these utilities could be provided to whoever scheduled them.
If the command specified on the taskrun
command line has a file association then that is used when creating the
command string which is passed to
The input arguments specified on the command line are used as the standard input for command, with each argument being treated as one line of input.
On 7/2008R2/8/2012/10/2016, errors produced while running taskrun are written to the Event Log.
All log files used by taskrun are locked so that only one instance of taskrun can write to a particular log file at a particular time. They are not locked to prevent users from edit them. This means that it is possible for you to be editing a log file when taskrun attempts to append to it and thus, lose the appended material. For this reason, you should be very careful when editing log files.
When the specified command is a DOS (16-bit) utility, anything written to the standard error is not redirected.
Normally, when a scheduled task is run, an empty console window is displayed. To prevent this display, you must do the following:
lets the user know that the command successfully executed if one or more of
-e, -l, or -mare specified and the command successfully executed without producing any output. -ccalling_command
specifies the command that called taskrun. If this option is not specified, calling_command defaults to taskrun.
is only valid on 7/2008R2/8/2012/10/2016 and writes any output or errors produced to the Event Log. If
-ais also specified and no output or errors are produced, a message indicating that the command executed successfully is written to the Event Log.
Each Event Log entry added by taskrun is limited to a length of 8192 bytes. If you are expecting more than 8192 bytes of output, you should also use
-lor -mto ensure that all output is captured.
The Event Source for these messages is the calling_command.
If you want your Event Log messages to be properly formatted, you should do the equivalent of the following for every calling_command:
registry -s \ -k 'HKLM\System\CurrentControlSet\Services\EventLog\Application\calling_command' \ -n EventMessageFile -V 'str:c:\winnt\system32\mksmsg.dll' registry -s \ -k 'HKLM\System\CurrentControlSet\Services\EventLog\Application\calling_command' \ -n TypesSupported -V dword:0x7
appends any output or errors produced to the specified logfile. If
-ais also specified and no output or errors are produced, a message indicating that the command executed successfully is written to logfile. -Mmail_command
when sending e-mail, taskrun uses the command specified by mail_command to actually send the e-mail. The specified mail_command must accept the following option syntax:
-f from_address -m file_to_be_mailed -s subject to_address
The specified mail_command can be a MKS KornShell script; however, in that case, the specified script name must have either a .ksh or .sh extension.
When this option is not given, taskrun uses the MKS Toolkit smtpmail command to send e-mail.
uses smtpmail to e-mail the output and errors produced by the command to the specified user. If no output or errors are produced, no e-mail is sent, unless
-ais also specified, in which case, an e-mail indicating that the command executed successfully is sent to user.
The calling_command is used as the from line for all e-mail messages sent. The first word of command is used as the subject line.
When taskrun sends e-mail using smtpmail, the Date: fields are set by the system that runs the task. The Received date is setup by the SMTP Mail server, and if the time is set differently on the two systems, discrepancies may appear in the e-mail you receive. For example, if the SMTP Mail server's time is slightly behind that of the system that ran the task, it could appear that you received the e-mailed output from the task before it was run.
taskrun -e -c at cat 1 2 3
results in the following message being added to the Event Log for at:
Date: 20010911091402 Command: cat Input: 1 2 3 ExitCode: 0 1 2 3
When this variable is set, file associations are not used when creating the command string passed to the
When this variable is set, the Enhanced UNIX Compatibility Mode is on and the virtual file system is in use.
When the Enhanced UNIX Compatibility Mode is on, all path names in the commands that you schedule should be Windows path names. In addition, information about a scheduled job (such as the working directory) is displayed using Windows path names.
For details on the Enhanced UNIX Compatibility Mode and the virtual file system, see the EUCM reference page.
Possible exit status values are:
Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
MKS Toolkit Scheduling Solutions Guide
PTC MKS Toolkit 10.1 patch 1 Documentation Build 2.