Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista General Discussion > Cannot create run-once task with schtasks

Reply
Thread Tools Display Modes

Cannot create run-once task with schtasks

 
 
Graeme Perrow
Guest
Posts: n/a

 
      03-18-2008
I am trying to create a task that runs once and then gets deleted. According
to (my interpretation of) the schtasks /? information, this should work:

schtasks /create /sc once /tn OneSync /tr C:\bat\sync.bat /st 10:58 /F /Z

This should run c:\bat\sync.bat at 10:58am today (assuming it's before
10:58am now), and then delete the task (/Z). However, I get this message:

ERROR: The task XML is missing a required element or attribute.

If I take the /Z away, the task is created as expected and runs at the right
time, but does not get deleted afterwards.

I am running (64-bit) Vista. Is this a bug, or am I missing something? If I
do the same thing on XP (without /F and /Z) the task is created, runs at the
right time, and then vanishes, which is exactly what I want.
 
Reply With Quote
 
 
 
 
Jon
Guest
Posts: n/a

 
      03-18-2008
Using the /V1 switch seemed to work here - notepad ran and then the task was
deleted- although I had to enter the password manually in this case. You
may be able to tweak it further.

schtasks /create /sc once /tn Notepad /tr C:\Windows\System32\notepad.exe
/st 19:02 /F /Z /V1

--
Jon


"Graeme Perrow" <> wrote in message
news:7F2FEA13-07F1-445E-857A-...
>I am trying to create a task that runs once and then gets deleted.
>According
> to (my interpretation of) the schtasks /? information, this should work:
>
> schtasks /create /sc once /tn OneSync /tr C:\bat\sync.bat /st 10:58 /F /Z
>
> This should run c:\bat\sync.bat at 10:58am today (assuming it's before
> 10:58am now), and then delete the task (/Z). However, I get this message:
>
> ERROR: The task XML is missing a required element or attribute.
>
> If I take the /Z away, the task is created as expected and runs at the
> right
> time, but does not get deleted afterwards.
>
> I am running (64-bit) Vista. Is this a bug, or am I missing something? If
> I
> do the same thing on XP (without /F and /Z) the task is created, runs at
> the
> right time, and then vanishes, which is exactly what I want.


 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Task Scheduler - command <schtasks /query /fo csv /nh> does not wo Herman VL Windows Vista General Discussion 2 11-13-2007 02:12 PM
Unable to use Schtasks command to schedule task for users group Umer Y Windows Vista General Discussion 0 09-27-2007 03:31 PM
Can't display or change a task with schtasks.exe clayga Windows Vista Administration 0 08-03-2007 06:16 PM
schtasks Does Not Run It When The Path of the Task Contains a Spac IseeVista Windows Vista General Discussion 1 03-28-2007 12:49 AM
Creating a Schedule Task in Vista with schtasks, Getting Access De Karl[US] Windows Vista General Discussion 0 02-20-2007 09:44 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59