我正在使用以下命令创建作业:
wmic job call create "C:\Windows\system32\defrag.exe",0,127,FALSE,TRUE,"********000000.000000-500"
但我一直收到错误:
Invalid format.
Hint: <paramlist> = <param> [, <paramlist>].
我在网上看到了类似的语法,所以我有点困惑为什么它不能在我的系统上工作。提醒管理员进一步测试。
我注意到此方法的help命令似乎与MSDN描述不同。
帮助:
Call [ In/Out ]Params&type Status
==== ===================== ======
Create [IN ]Command(STRING) (null)
[IN ]DaysOfMonth(UINT32)
[IN ]DaysOfWeek(UINT32)
[IN ]InteractWithDesktop(BOOLEAN)
[IN ]RunRepeatedly(BOOLEAN)
[IN ]StartTime(DATETIME)
[OUT]JobId(UINT32)
MSDN链接: https://msdn.microsoft.com/en-us/library/aa389389(v=vs.85).aspx
尽量避免使用PowerShell(Get-WmiObject)。谢谢大家!
答案 0 :(得分:0)
您还应指定每个属性名称:
wmic job call create Command =“C:\ Windows \ system32 \ defrag.exe”,DaysOfMonth = 0,DaysOfWeek = 127,InteractWithDesktop = FALSE,RunRepeatedly = TRUE,StartTime =“******** 000000.000000 -500"
Executing (Win32_ScheduledJob)->Create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
JobId = 1;
ReturnValue = 0;
};
根据MSDN,DaysOfMonth=0
和DaysOfWeek=127
的值也不正确。