#68579 - 2002-07-24 12:10 AM
FYI - JT.exe commandline options (long post!!!)
|
MightyR1
MM club member
Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
|
Hi all,
For all those (future) JT users out there, here's an output of all commandline options of JT.EXE (available in jt.zip from MickeySoft ftp-site) .
code:
**************************************** *** Summary help info **************************************** Microsoft (R) Task Scheduler Command Line Utility Copyright (C) Microsoft Corp 1995-1998. All rights reserved. This executable compiled as a retail build for the Windows NT Resource Kit. usage: JT {[options]|[@commandfile]} options: @ <file> - parse file /? [cmd] - display help on [cmd], e.g. /? abj !<cmd> - don't stop if command returns error /ABJ - abort task /CSAGE - convert SAGE tasks to tasks (Win9x only) /CTJ [<props>] - create trigger in task /DTJ [<id>] - delete trigger <id> (default 0) from task /EJ [<n> [T|F]] - edit task page <n>, persist changes T/f /ENC <id1> <id2> - enumerator clone <id1> from <id2> (see SCE command) /ENN <id> <n> - enumerate next <n> items (see SCE command) /ENR <id> - enumerator reset (see SCE command) /ENS <id> <n> - enumerator skip forward by <n> (see SCE command) /GC - get credential account name /GM - get target machine /ISJQ <file> - test <file> to see if it is a task /LJ <file> - load task object from <file> /PJ - print all properties of task /PRJ [<n>] - print next <n> or today's remaining run times of task /PSJ [<id>] - print trigger strings of <id> or all in task /PTJ [<id>] - print trigger props of <id> or all in task /RJ - run task /SAC <file> - scheduler activate task (load tasks\<file>) /SAJ <file> - scheduler add task (save as tasks\<file>) /SC <acct> <pwd> - set task credentials /SCE <id> - scheduler create enumerator in slot <id>=0..9 /SD <file> - scheduler delete task (delete tasks\<file>) /SE [<n>] [P] - scheduler enum tasks <n> at a time, [P]rint /SJ <props> - set task's properties /SM [<machine>] - set machine (NULL = local machine if omitted) /SNJ <file> - scheduler new task (replaces in-memory task object) /STJ [id] props - set properties of task trigger <id> or 0 /SVJ [<file>] - save task to <file> For detailed help use: JT /? <command-name>, e.g. JT /? LJ. **************************************** *** @ **************************************** Command: @ <file> Purpose: Read commands from a file. Arguments: <file> - name of file from which to read commands. Remarks: Blank lines and all characters following semicolons are ignored. Environment variables are expanded (just like batch files). Recursion is allowed. Examples: @script **************************************** *** ! **************************************** No help available **************************************** *** ABJ **************************************** Command: /ABJ - abort task Purpose: Invoke the Abort command on the task. Examples: /RJ /ABJ - runs a task, then aborts it **************************************** *** CSAGE **************************************** No help available **************************************** *** CTJ **************************************** Command: /CTJ [<props>] - create trigger in task Purpose: Create a new trigger. Arguments: [<props>] - Optional list of trigger properties. Remarks: The property list has the form <propname> = <value>... The trigger properties and form of their values: StartDate = <date> EndDate = <date> StartTime = <time> MinutesDuration = n MinutesInterval = n HasEndDate = {1|0} KillAtDuration = {1|0} Disabled = {1|0} Type = {Once|Daily|Weekly|MonthlyDate|MonthlyDOW|OnIdle|AtStartup|AtLogon} TypeArguments = <type-args-list> <date> - { m/d/y | TODAY } <time> - { h:m | NOW } <type-args-list> - see below Note that NOW is actually 60 seconds in the future so it can be used to create triggers that will fire soon. The following table lists the forms of the <type-args-list> property value for each of the trigger types: Trigger Argument List Argument meanings Type Format ----------- ------------ ---------------------------- DAILY n DaysInterval WEEKLY n, <DOW> WeeksInterval, DaysOfTheWeek MONTHLYDATE <DOM>, <months> DaysOfTheMonth, Months MONTHLYDOW n, <DOW>, <months> Week, DaysOfTheWeek, Months ONCE (no args) ONIDLE (no args) ATSTARTUP (no args) ATLOGON (no args) <DOW> is a string with one letter per weekday. To specify the task is to run on every day, use the string UMTWRFA. To specify no days use a period. <DOM> is a comma-separated list of day numbers and ranges. Some examples: 1-31 10 20,21,22 1,3,5,7-10 2-8,20,12 <months> is a string containing three letter abbreviations for months. For all months, use: JanFebMarAprMayJunJulAugSepOctNovDec (case and order are not significant). The trigger type must be specified before the type arguments, otherwise properties may appear in any order. Case, whitespace, and leading zeros are not significant. Examples: /ctj - creates a trigger with default values /ctj StartTime=13:40 StartDate=3/4/1996 type=weekly typearguments = 1,mwf **************************************** *** DTJ **************************************** Command: /DTJ [<id>] - delete trigger <id> (default 0) from task Purpose: Delete a single trigger from task. Arguments: [<id>] - 0-based index of trigger to delete. If omitted, trigger 0 will be deleted. Examples: /dtj 3 **************************************** *** EJ **************************************** No help available **************************************** *** ENC **************************************** No help available **************************************** *** ENN **************************************** No help available **************************************** *** ENR **************************************** No help available **************************************** *** ENS **************************************** No help available **************************************** *** GC **************************************** Command: /GC - get credentials (account name only) Purpose: Print the credential account name Examples: /gc - print the credential account name. **************************************** *** GM **************************************** Command: /GM - get target machine Purpose: Print the name of the currently targeted machine Remarks: This should appear as \\machine-name. Note also that the target machine is not persisted across multiple runs of JT. Examples: /gm - print the name of the current target of Scheduler commands. **************************************** *** ISJQ **************************************** No help available **************************************** *** LJ **************************************** Command: /LJ <file> - load task object from <file> Purpose: Load a task file. Arguments: <file> - file to load. Remarks: JT acts like notepad.exe, in that when it starts it creates a blank task object, and all commands operate on that object. You can fill that blank object by loading a file from disk, or by putting data into it using the /SJ (set task) command. Every Save command (/SVJ) is actually a Save As. Just before JT exits, it checks to see if the task object is dirty. If a name has been associated with it by a Load or Save command, it will be saved automatically. The task object is *not* automatically saved before being loaded if it is dirty. See also the /SAC command. Examples: /lj mytask.job /pj - load mytask.job into the in-memory task object, then print all its properties. **************************************** *** PJ **************************************** Command: /PJ - print all properties of task Purpose: Print properties and triggers of task. Remarks: To print only a single trigger, use PTJ. To print only a trigger string, use PSJ. Examples: /pj **************************************** *** PRJ **************************************** Command: /PRJ [<n>] - print next <n> or today's run times of task Purpose: Print next run times of task. Arguments: <n> - number of run times to print. If omitted, print run times from now till the end of today Examples: /prj - print remaining run times for today /prq 4 - print next 4 run times **************************************** *** PSJ **************************************** Command: /PSJ [<id>] - print trigger strings of <id> or all in task Purpose: Print one or all trigger strings of task. Arguments: [<id>] - 0-based index of trigger to print string for. If omitted, print all trigger strings. Examples: /psj - print all trigger strings /psq 4 - print string for trigger 4 **************************************** *** PTJ **************************************** Command: /PTJ [<id>] - print trigger props of <id> or all in task Purpose: Print the properties of one or all triggers of task. Arguments: [<id>] - 0-based index of trigger to print. If omitted, print all triggers. Examples: /ptj - print properties of all triggers **************************************** *** RJ **************************************** Command: /RJ - run task Purpose: Run the task. Examples: /lj mytask.job /rj - load mytask.job into the in-memory task object, then run it. **************************************** *** SAC **************************************** Command: /SAC <file> - task file to activate (load). Purpose: Load the specified task object into the in-memory task object. If the in-memory object is dirty, it will be saved first. Arguments: <file> - file to load. Examples: /sac foo.job - load <tasks folder>\foo.job into the in-memory task object. /sac bar - load <tasks folder>\bar.job into the in-memory task object. **************************************** *** SAJ **************************************** Command: /SAJ <file> - save in-memory task object in tasks\<file>. Purpose: Save the in-memory task object in the tasks folder. Arguments: <file> - filename to save. Remarks: This command acts as a Save As operation. Any changes made to the in- memory object after this command is executed will automatically be saved to <file> before JT exits. The scheduler will return an error if tasks\<file> exists. Examples: /saj foo.job - save the in-memory task object in <tasks folder>\foo.job. **************************************** *** SC **************************************** Command: /SC <new acct> <new pswd> - create/set credentials. Purpose: Specify new or change existing task credentials. Arguments: <new acct> - new account name. Mandatory. <new pswd> - new password. Specify the string "" for a blank password. Remarks: The password may also specified as NULL if the account name is set. NULL as a password indicates that the task should be run ONLY if the specified user is logged on at the time the task is set to execute. Users may create tasks of this type only for themselves. Administrators may create them for any user. Examples: /sc MYDOMAIN\joeuser JoesPassword - Specify new credentials. **************************************** *** SCE **************************************** No help available **************************************** *** SD **************************************** Command: /SD <file> - delete tasks\<file>. Purpose: Delete the specified task object from the tasks folder. Arguments: <file> - filename of task object to delete. Examples: /sd foo.job - delete <tasks folder>\foo.job. **************************************** *** SE **************************************** Command: /SE [<n>] [P] - scheduler enum tasks <n> at a time, [P]rint Purpose: Enumerate all tasks in the tasks folder, optionally printing all the properties of each. Arguments: [<n>] - optional value to use for celt in IEnumWorkItems::Next. [P] - optional flag to make JT dump properties of enumerated objects. Remarks: If the [P] flag is not specified, only the names of the enumerated objects are displayed. Examples: /se - print the names of all objects in the tasks folder, one per line. /se p - print all properties of all objects in the tasks folder /se 2 - print the names of all objects in the tasks folder, one per line. use 2 for the celt argument to IEnumWorkItems::Next. **************************************** *** SJ **************************************** Command: /SJ <props> - set task's properties Purpose: Change one or more properties on the in-memory task object. Arguments: <props> - list of task properties. Remarks: The property list has the form <propname> = <value>... The task properties and the form of their values: ApplicationName = <path> Parameters = <string> WorkingDirectory = <path> Comment = <string> Creator = <string> Priority = { Idle | Normal | High | Realtime } MaxRunTime = <int> (in milliseconds) Idle = <int> <int> (wait & deadline, in minutes) Interactive = { 1 | 0 } DontStartIfOnBatteries = { 1 | 0 } KillIfGoingOnBatteries = { 1 | 0 } RunOnlyIfLoggedOn = { 1 | 0 } SystemRequired = { 1 | 0 } DeleteWhenDone = { 1 | 0 } Suspend = { 1 | 0 } HaltOnError = { 1 | 0 } StartOnlyIfIdle = { 1 | 0 } KillOnIdleEnd = { 1 | 0 } RestartOnIdleResume = { 1 | 0 } Hidden = { 1 | 0 } TaskFlags = <int> (in decimal) <string> - must be surrounded by double quotes if it contains spaces <date> - { m/d/y | TODAY } <int> - any integer Case is not significant (i.e., IDLE and Idle are both legal). Examples: /sj command = notepad.exe Priority=idle DeleteWhenDone=1 **************************************** *** SM **************************************** Command: /SM [<machine>] - set machine (NULL = local machine if omitted) Purpose: Retarget future ITaskScheduler methods at a remote or the local machine. Arguments: [<machine>] - machine to target, in the form \\machine-name. Remarks: If argument is omitted, command targets local machine. The argument may also explicitly target the local machine. Note that the machine choice is not persisted across invocations of JT. Examples: /sm - target the local machine. !sm bogus /gm - attempt to target a non-existent machine, then print currently targeted machine (to verify that it hasn't changed). **************************************** *** SNJ **************************************** Command: /SNJ <file> - create tasks\<file> and load it into in-memory task object. Purpose: Create a new, empty task object in the tasks folder and load it into the in-memory task object. Arguments: <file> - filename of task object to load. Remarks: CAUTION: the in-memory task object is NOT SAVED before being replaced. This allows you to test the behavior of the task object when it is released while dirty. Examples: /ctj /snj foo.job - modify the in-memory task object, then create <tasks folder>\foo.job, and load it into the in-memory task object without first saving the existing in-memory object. **************************************** *** STJ **************************************** Command: /STJ [id] <props> - set properties of trigger [id] on task Purpose: Change one or more properties of a trigger in the in-memory task object. Arguments: [id] - trigger number. If omitted, trigger 0 is modified. <props> - list of trigger properties. Remarks: The property list has the form <propname> = <value>... The trigger properties and form of their values: StartDate = <date> EndDate = <date> StartTime = <time> MinutesDuration = n MinutesInterval = n HasEndDate = {1|0} KillAtDuration = {1|0} Disabled = {1|0} Type = {Once|Daily|Weekly|MonthlyDate|MonthlyDOW|OnIdle|AtStartup|AtLogon} TypeArguments = <type-args-list> <date> - { m/d/y | TODAY } <time> - { h:m | NOW } <type-args-list> - see below Note that NOW is actually 60 seconds in the future so it can be used to create triggers that will fire soon. The following table lists the forms of the <type-args-list> property value for each of the trigger types: Trigger Argument List Argument meanings Type Format ----------- ------------ ---------------------------- DAILY n DaysInterval WEEKLY n, <DOW> WeeksInterval, DaysOfTheWeek MONTHLYDATE <DOM>, <months> DaysOfTheMonth, Months MONTHLYDOW n, <DOW>, <months> Week, DaysOfTheWeek, Months ONCE (no args) ONIDLE (no args) ATSTARTUP (no args) ATLOGON (no args) <DOW> is a string with one letter per weekday. To specify the task is to run on every day, use the string UMTWRFA. To specify no days use a period. <DOM> is a comma-separated list of day numbers and ranges. Some examples: 1-31 10 20,21,22 1,3,5,7-10 2-8,20,12 <months> is a string containing three letter abbreviations for months. For all months, use: JanFebMarAprMayJunJulAugSepOctNovDec (case and order are not significant). The trigger type must be specified before the type arguments, otherwise properties may appear in any order. Case, whitespace, and leading zeros are not significant. Examples: /stj enddate=today - set the end date of trigger 0 on the in-memory task object to today's date. **************************************** *** SVJ **************************************** Command: /SVJ [<file>] - save task to <file> Purpose: Write the task to disk. Arguments: <file> - file to save. If omitted, saves to last file loaded or saved. Remarks: Any task object which has an associated filename (because it's been used with the LJ, SAJ, SNJ, SAC commands) will automatically be saved, if it has been modified, just before JT exits. Therefore these save commands are most useful for doing a save as. Examples: /sac a.job /svj b.job - load <tasks folder>.job into the in-memory task object, then save it to b.job in the current directory.
[ 24 July 2002, 08:41: Message edited by: MightyR1 ]
_________________________
Greetz, Patrick Rutten
- We'll either find a way or make one... - Knowledge is power; knowing how to find it is more powerful... - Problems don't exist; they are challenges...
|
Top
|
|
|
|
#68582 - 2002-07-24 10:30 AM
Re: FYI - JT.exe commandline options (long post!!!)
|
José Miguel
Fresh Scripter
Registered: 2002-07-01
Posts: 16
|
Windows XP brings a feasible one in line of commandos that replaces it, is called "schtasks.exe ".
|
Top
|
|
|
|
#68585 - 2002-07-25 02:03 PM
Re: FYI - JT.exe commandline options (long post!!!)
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
schtasks.exe, looks like it Replaces AT/Winat...
The only issue I have with that is the flexibility. At least with task scheduler, you can define a task to run with pretty intersting constraints.
Thanks,
Kent
|
Top
|
|
|
|
#68587 - 2002-07-27 08:06 AM
Re: FYI - JT.exe commandline options (long post!!!)
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Cool hack..
Will have to try that one!!
Thanks Jens.
Kent
|
Top
|
|
|
|
#68588 - 2003-03-10 09:38 PM
Re: FYI - JT.exe commandline options (long post!!!)
|
Jopeke
Lurker
Registered: 2003-03-10
Posts: 4
Loc: Belgium
|
Hi I have tested jt.exe and it is working fine. But if you want to add a sched task you have to supply a username and password (the task credentials) But this is a problem ,because I want to use this for an end user but if he start a script how do I get his password.
_________________________
Jopeke
|
Top
|
|
|
|
#68591 - 2003-03-11 04:47 AM
Re: FYI - JT.exe commandline options (long post!!!)
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11624
Loc: CA
|
Hi Glenn,
I've mentioned a few times that I will host file\documentation that currently can't reside on kixtart.org over on my site. http://www.kixhelp.com
If you want, send me the zip file along with any other notations you would like added and I'll post it to my site as soon as I can.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(mole)
and 598 anonymous users online.
|
|
|