Georges,

tcLib just looks intimidating.. ;\) It's actually fairly easy to use. With just four lines of code - init, defineTask, defineTrigger, and setEvent, you can create or update a task event anywhere.

The ZIP file with the tcLib package includes jt.exe and a short Programmer's Reference Guide with several examples. To accomplish what you need, you'd put JT into the C:\Windows folder (or - better - another folder that is defined in the PATH), put tclib.udf on your system, and create the following code:
 Code:
Call '.\tclib.udf'
$aWhen = Split(TimeConvert(TimeConvert(@DATE + ' ' + @TIME) + 120), ' ')
tcInit()      ; init the library, prepare the arrays
$Rc = tcDefineTask('APP=command PRM=arg list USR=userid PWD=password')
$Rc = tcDefineTrigger(0, 'TYP=Once STM=' + $aWhen[1] + ' SDT=' + $aWhen[0])
If tcSetEvent(@WKSTA, 'RunSoon')
  'Success!' ?
Else
  'Failed to create task: ' tcErrMsg(@ERROR) ?
EndIf
The first line creates a 2-element array containing the date and time 2 minutes from now. This uses the TimeConvert example shown earlier wrapped in a Split to separate the date and time components.

The tcDefineTask defines the command, its arguments, and the credentials used to run the task. This is known as the "TASK" part of the scheduled "EVENT". Note that JT does not support Interactive processing as this was eliminated in W2K3 and later releases of XP to close security issues. You might want to add "DWD=1" to delete the task event when it is complete.

tcDefineTrigger defines when the task will run. It defines the type of trigger (run once) and the date & time as provided by the 2 array elements.

tcSetEvent creates or updates the event on the target system, calling it "RunSoon". Unlike AT jobs which have job numbers, task events can have meaningful names.

If an error occurs, the @ERROR macro is passed to tcErrMsg to return a message that is specific to the task event. This function will return standard @SERROR messages unless the error code has special meaning to JT, in which case a specific message will be returned instead.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D