Task Scheduler vs. Schedule Service

You are here:
< Back
Task Scheduler vs. Schedule Service
Last Updated: 26 May 2006  (Prior Update: 31 Oct 2005)

*** PLEASE NOTE: Link(s), If Provided, May Be Wrapped ***

Internet Explorer 4 & 5 come with Task Scheduler, which
replaces the normal Scheduler service of Windows NT. This
service is also the default for Windows 2000, so you might
just want to get used to it.

The primary difference between the Task Scheduler and the
old Scheduler service, is that the new service always runs
as the SYSTEM account, but each job can be configured to
run with different credentials.

In Win2K, if you want to change the credentials of all
scheduler jobs, open the "Scheduled Tasks" folder, click
on "Advanced" and select "AT Service Account".

For more info about the new "Task Scheduler" and how it
differs from the old "Scheduler" service, see:

• http://support.microsoft.com/?KBID=235536http://www.microsoft.com/TechNet/winnt/Winntas/technote/TASKSCHD.asphttp://support.microsoft.com/default.aspx?support/windows/InProductHelp98/agent_plus_at.asp


• http://www.winnetmag.com/windowsnt20002003faq/Article/ArticleID/14628/windowsnt20002003faq_14628.htmlhttp://support.microsoft.com/?KBID=223170http://support.microsoft.com/?KBID=237840http://search.microsoft.com/us/itresources/SearchMS.asp?IntCat=0&IntCat=1&Boolean=PHRASE&Nq=NEW&qu=Task+Schedulerhttp://support.microsoft.com/?KBID=208675http://support.microsoft.com/?KBID=222628http://support.microsoft.com/?KBID=308558


• http://windowscommand.uw.hu/wincmd0030.htmlhttp://www.winnetmag.com/windowsnt20002003faq/Article/ArticleID/24062/windowsnt20002003faq_24062.htmlhttp://www.winnetmag.com/windowsnt20002003faq/Article/ArticleID/25186/windowsnt20002003faq_25186.htmlhttp://www.jsiinc.com/subf/tip2600/rh2621.htmhttp://www.jsiinc.com/SUBP/tip7500/rh7524.htmhttp://www.jsifaq.com/subj/tip4800/rh4806.htmhttp://is-it-true.org/nt/xp/atips/atips33.shtmlhttp://www.microsoft.com/TechNet/prodtechnol/winxppro/proddocs/schtasks.asphttp://support.microsoft.com/?KBID=814596http://support.microsoft.com/?KBID=823093http://windows.about.com/library/tips/bltip638.htm


The SCHTASKS command requires very weird syntax if you
wish to schedule a command which has a space as part of
its parameters (or PATH)

So, scheduling the following file and paramater:
  Executable ....... C:\bin\MyEXE
  Parameter ........ "C:\Long Name\Longer Name File.TXT"

...will look like this:

  SCHTASKS /CREATE /TN "JobName" /TR ""C:\bin\MyEXE ""C:\Long Name\Longer" "Name" "File.TXT""" /SC DAILY /ST 01:00 /RU "SYSTEM"

One method is to surround the entire parameter in
a pair of double quotes, plus, quote each space in the
parameter individually.  This has a single drawback,
which will be addressed below.

An easier (more readable) way to present the above line
is as follows:

  SET @JOBNAME=C:\bin\MyEXE ""C:\Long Name\Longer" "Name" "File.TXT""

It would have been nice to be able to use escape
characters (like ^) to present it like this instead:

  SCHTASKS /CREATE /TN "JobName" /TR "C:\bin\MyEXE ^"C:\Long Name\Longer Name File.TXT^"" /SC DAILY /ST 01:00 /RU "SYSTEM"

...but alas, this is not to be -- or, I couldn't figure
out what escape characters to use, and trust me when I
say that I tried lots and lots of combinations before I
stumbled across the correct approach.

Update 26 May 2006:
Look what I found in http://support.microsoft.com/?KBID=823093:

Looks like the escape character is \ and not ^

For example, the following example task does not run when you schedule it:
	schtasks /create /tn "my task" /tr "c:\foldername containing spaces\script.bat arguments" /sc once /sd 07/29/2003 /st 10:01

However, when you enclose the path of the task between the backslash and quotation marks character combinations as in the following example, the scheduled task runs successfully:
	schtasks /create /tn "my task" /tr "\"c:\foldername name containing spaces\script.bat\" arguments" /sc once /sd 07/29/2003 /st 10:01


If you desire to switch it back to the old service under
NT4, you can use the SC.EXE command (from the ResKit) as

@sc config Schedule type= own binPath= %SystemRoot%\system32\AtSvc.exe DisplayName= Schedule depend= ""

The above command should be on a single line...

Under XP and 2003, the SCHTASKS command provides far more
flexibility for commandline job manipulation than the AT
command ever did.


• http://www.gibinsoft.com/http://www.americansys.com/ezscheduler.htmhttp://www.hiteksoftware.com/http://www.tomasello.com/software/wincron/http://downloads-zdnet.com.com/3120-20-0.html?qt=scheduler&tg=dl-2001http://www.liebsoft.com/index.cfm/products/tsp


• 05/2006:
  I finally found the Microsoft KB which talks about how
  to manage paths that contain a space and also need to
  have parameters.  It is described in the following KB:

• 10/2005:
  The version of SCHTASKS provided under Windows 2003
  supports a few additional parameters, such as /F, that
  fail under other versions of Windows (2000 and XP), so
  a special version test is executed to determine which
  OS is running, and use the appropriate switches.

• Windows XP comes with a command line executable for
  managing Scheduled Jobs which replaces AT.EXE

• The SCHTASKS.EXE from WinXP can be run under 2000 if
  the file is hex edited.