powershell change scheduled task

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
https://www.cnblogs.com/jmilkfan-fanguiju/p/7533729.html<br><br><br>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 @   CrossPython  阅读(33)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下
点击右上角即可分享
微信分享提示