1

I'm trying to run this in a Win 7 Professional admin console:

schtasks /create /tn "Task at 16:40 on 10/27/2012"
    /sc "once" /st "16:40" /sd "10/27/2012"
    /tr "c:\python27\python.exe c:\users\jost\Desktop\executeScript.py"

All referenced files exist. The error message I get is

ERROR: The filename, directory name, or volume label syntax is incorrect.

What is wrong? Running the command directly on the command line works fine.

1 Answer 1

6

It has nothing to do with your target, it means that schtasks cannot create a task with a given name. That's because task is stored in a filesystem and you cannot use : or / in a file name.

Thank you Microsoft for meaningful error messages! What's interesting, previous (xp) version simply prints:

ERROR: The creation of the scheduled task failed. Reason: The Task Name may not contain the characters: <, >, :, /, \,|

What the hell was wrong with that?

2
  • 1
    You're probably right, but if it's because the task name is invalid, why does the command work when run from the command line instead of the admin console as the OP states?
    – martineau
    Oct 27, 2012 at 18:29
  • @martineau I understood that by 'command' OP meant python script
    – wmz
    Oct 27, 2012 at 19:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .