简体   繁体   English

从cmd更改计划的任务

[英]Changing a scheduled task from cmd

SchTasks /Change /TN "cs2kconnect" /ST 06:00

I am getting Error the Parameter is Incorrect 我收到错误的参数不正确

The taskname is correct as I copied it directly, and when I put in a bad time it says /ST is Invalid. 任务名称是正确的,因为我直接复制了它,当我输入错误的时间时,它说/ ST无效。

I have managed to edit it other tasks using the same process, just this one does not want to change have tested this on multiple machines. 我设法使用相同的过程来编辑其他任务,只是这一不想更改的已经在多台机器上进行了测试。

Any ideas? 有任何想法吗?

This is running under windows 7 这是在Windows 7下运行

Though the question is very old but my answer below could be helpful to anybody still searching. 尽管问题很老,但我在下面的回答对仍在搜索的任何人都可能有帮助。

If you have made sure the name of the task and the parameter values are all correct and still face this error, then it is not because of the command you are running but because of the setup of the task. 如果确定任务名称和参数值都正确并且仍然遇到此错误,则不是由于您正在运行的命令而是由于任务的设置。

You will face this error in 2 cases, first is when you create a Scheduled Task from the GUI and add a Trigger and not change the default Start Time. 在2种情况下,您将遇到此错误,首先是从GUI创建计划任务并添加触发器而不更改默认的开始时间。 Second is when you add an Expire date and not change the default date that is set. 其次是当您添加一个到期日期而不更改设置的默认日期时。 Task Scheduler - Trigger setup 任务计划程序-触发器设置

The reason we get this error is becuase when you setup a trigger and not change its Start time or Expire time, the task scheduler creates it with milliseconds included, you can see that when you export the task to an XML. 之所以会出现此错误,是因为设置触发器而不更改其开始时间或到期时间时,任务计划程序会以毫秒为单位创建触发器,您可以看到将任务导出到XML时的情况。 You will find that after you make any change to the start time and expire time (if it exists) and then export the to XML the milliseconds part is gone. 您将发现对开始时间和到期时间(如果存在)进行了任何更改,然后将导出到XML,毫秒部分就消失了。 Task Scheduler - XML Export 任务计划程序-XML导出

To me it seems that when we run the "schtasks /change" command it validates the existing start time and expire time format before applying any change and it fails with this error which is definitely not very descriptive or accurate. 在我看来,当我们运行“ schtasks / change”命令时,它会在应用任何更改之前先验证现有的开始时间和到期时间格式,并且由于此错误而失败,该错误绝对不是非常描述性或准确性。

So, the solution is just make a small change to the times (you can change it back to original value) and then run the same command and it should work fine. 因此,解决方案是对时间进行少量更改(您可以将其更改回原始值),然后运行相同的命令,它应该可以正常工作。

This error occurs only in Windows 7 / Windows Server 2008 R2 or earlier versions of OS. 仅在Windows 7 / Windows Server 2008 R2或更早版本的OS中会发生此错误。

The reason for this error is rather strange and may be is a bug in Windows which Microsoft fixed in later OS versions or in an Update which I could not find. 此错误的原因很奇怪,可能是Windows中的一个错误,Microsoft已在更高的OS版本中修复了该错误,或​​者在我找不到的更新中进行了修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM