Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Oct 27 '12 at 14:48

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 5 down vote accepted

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?

share|improve this answer
    
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 '12 at 18:29
    
@martineau I understood that by 'command' OP meant python script –  wmz Oct 27 '12 at 19:04
    
Thanks! Good one, Microsoft :-) –  Jost Oct 28 '12 at 0:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.