powershell change scheduled task

https://www.cnblogs.com/jmilkfan-fanguiju/p/7533729.html


Windows PowerShell 版权所有 (C) Microsoft Corporation。保留所有权利。 尝试新的跨平台 PowerShell https://aka.ms/pscore6 PS C:\Windows\system32> $Task = Get-ScheduledTask -TaskName "1t" PS C:\Windows\system32> $Task.Actions[0] = "new arguments string go here" 无法将值“new arguments string go here”转换为类型“Microsoft.Management.Infrastructure.CimInstance”。错误:“指定的参 数已超出有效值的范围。 参数名: className” 所在位置 行:1 字符: 1 + $Task.Actions[0] = "new arguments string go here" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [],RuntimeException + FullyQualifiedErrorId : InvalidCastConstructorException PS C:\Windows\system32> $Task.Actions[0] = "abcde" PS C:\Windows\system32> Set-ScheduledTask $Task TaskPath TaskName State -------- -------- ----- \ 1t Ready PS C:\Windows\system32> $Task = Get-ScheduledTask -TaskName "1t" PS C:\Windows\system32> $Task.Actions[0].Arguments PS C:\Windows\system32> $Task.Actions[0].Arguments = "c:\python.exe abcde" PS C:\Windows\system32> Set-ScheduledTask $Task TaskPath TaskName State -------- -------- ----- \ 1t Ready PS C:\Windows\system32>

  

posted @ 2022-04-22 22:07  CrossPython  阅读(31)  评论(0编辑  收藏  举报