@lppx/taskmgr 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +340 -0
- package/TaskScheduler.2.12.2/.signature.p7s +0 -0
- package/TaskScheduler.2.12.2/TaskScheduler.2.12.2.nupkg +0 -0
- package/TaskScheduler.2.12.2/TaskService.md +72 -0
- package/TaskScheduler.2.12.2/lib/net45/Microsoft.Win32.TaskScheduler.dll +0 -0
- package/TaskScheduler.2.12.2/lib/net45/Microsoft.Win32.TaskScheduler.xml +7855 -0
- package/TaskScheduler.2.12.2/lib/net45/de/Microsoft.Win32.TaskScheduler.resources.dll +0 -0
- package/TaskScheduler.2.12.2/lib/net45/es/Microsoft.Win32.TaskScheduler.resources.dll +0 -0
- package/TaskScheduler.2.12.2/lib/net45/fr/Microsoft.Win32.TaskScheduler.resources.dll +0 -0
- package/TaskScheduler.2.12.2/lib/net45/it/Microsoft.Win32.TaskScheduler.resources.dll +0 -0
- package/TaskScheduler.2.12.2/lib/net45/ja/Microsoft.Win32.TaskScheduler.resources.dll +0 -0
- package/TaskScheduler.2.12.2/lib/net45/pl/Microsoft.Win32.TaskScheduler.resources.dll +0 -0
- package/TaskScheduler.2.12.2/lib/net45/ru/Microsoft.Win32.TaskScheduler.resources.dll +0 -0
- package/TaskScheduler.2.12.2/lib/net45/sv/Microsoft.Win32.TaskScheduler.resources.dll +0 -0
- package/TaskScheduler.2.12.2/lib/net45/tr/Microsoft.Win32.TaskScheduler.resources.dll +0 -0
- package/TaskScheduler.2.12.2/lib/net45/zh-CN/Microsoft.Win32.TaskScheduler.resources.dll +0 -0
- package/TaskScheduler.2.12.2/lib/net45/zh-Hant/Microsoft.Win32.TaskScheduler.resources.dll +0 -0
- package/TaskScheduler.2.12.2/tsnew48.png +0 -0
- package/Templates//344/274/221/347/234/240/350/204/232/346/234/254.ps1 +3 -0
- package/Templates//345/200/222/350/256/241/346/227/266/344/274/221/347/234/240/350/204/232/346/234/254.ps1 +68 -0
- package/Templates//345/200/222/350/256/241/346/227/266/345/205/263/346/234/272/350/204/232/346/234/254.ps1 +66 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/commands/scripts/add.d.ts +9 -0
- package/dist/commands/scripts/add.js +28 -0
- package/dist/commands/scripts/list.d.ts +6 -0
- package/dist/commands/scripts/list.js +25 -0
- package/dist/commands/scripts/open.d.ts +6 -0
- package/dist/commands/scripts/open.js +19 -0
- package/dist/commands/tsk/add.d.ts +20 -0
- package/dist/commands/tsk/add.js +70 -0
- package/dist/commands/tsk/del.d.ts +9 -0
- package/dist/commands/tsk/del.js +14 -0
- package/dist/commands/tsk/list.d.ts +9 -0
- package/dist/commands/tsk/list.js +46 -0
- package/dist/hooks/init.d.ts +3 -0
- package/dist/hooks/init.js +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/task-scheduler.d.ts +37 -0
- package/dist/lib/task-scheduler.js +371 -0
- package/oclif.manifest.json +250 -0
- package/package.json +92 -0
package/README.md
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
@lppx/taskmgr
|
|
2
|
+
=================
|
|
3
|
+
|
|
4
|
+
定时任务管理器
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
[](https://oclif.io)
|
|
8
|
+
[](https://npmjs.org/package/@lppx/taskmgr)
|
|
9
|
+
[](https://npmjs.org/package/@lppx/taskmgr)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<!-- toc -->
|
|
13
|
+
* [Usage](#usage)
|
|
14
|
+
* [Commands](#commands)
|
|
15
|
+
<!-- tocstop -->
|
|
16
|
+
* [Usage](#usage)
|
|
17
|
+
* [Commands](#commands)
|
|
18
|
+
<!-- tocstop -->
|
|
19
|
+
# Usage
|
|
20
|
+
<!-- usage -->
|
|
21
|
+
```sh-session
|
|
22
|
+
$ npm install -g @lppx/taskmgr
|
|
23
|
+
$ tm COMMAND
|
|
24
|
+
running command...
|
|
25
|
+
$ tm (--version)
|
|
26
|
+
@lppx/taskmgr/0.0.0 win32-x64 node-v24.11.0
|
|
27
|
+
$ tm --help [COMMAND]
|
|
28
|
+
USAGE
|
|
29
|
+
$ tm COMMAND
|
|
30
|
+
...
|
|
31
|
+
```
|
|
32
|
+
<!-- usagestop -->
|
|
33
|
+
```sh-session
|
|
34
|
+
$ npm install -g @lppx/taskmgr
|
|
35
|
+
$ tm COMMAND
|
|
36
|
+
running command...
|
|
37
|
+
$ tm (--version)
|
|
38
|
+
@lppx/taskmgr/0.0.0 linux-x64 node-v20.20.1
|
|
39
|
+
$ tm --help [COMMAND]
|
|
40
|
+
USAGE
|
|
41
|
+
$ tm COMMAND
|
|
42
|
+
...
|
|
43
|
+
```
|
|
44
|
+
<!-- usagestop -->
|
|
45
|
+
# Commands
|
|
46
|
+
<!-- commands -->
|
|
47
|
+
* [`tm autocomplete [SHELL]`](#tm-autocomplete-shell)
|
|
48
|
+
* [`tm help [COMMAND]`](#tm-help-command)
|
|
49
|
+
* [`tm scripts add PATH`](#tm-scripts-add-path)
|
|
50
|
+
* [`tm scripts list`](#tm-scripts-list)
|
|
51
|
+
* [`tm scripts open`](#tm-scripts-open)
|
|
52
|
+
* [`tm tsk add TASKNAME`](#tm-tsk-add-taskname)
|
|
53
|
+
* [`tm tsk del TASKNAME`](#tm-tsk-del-taskname)
|
|
54
|
+
* [`tm tsk list`](#tm-tsk-list)
|
|
55
|
+
* [`tm version`](#tm-version)
|
|
56
|
+
|
|
57
|
+
## `tm autocomplete [SHELL]`
|
|
58
|
+
|
|
59
|
+
Display autocomplete installation instructions.
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
USAGE
|
|
63
|
+
$ tm autocomplete [SHELL] [-r]
|
|
64
|
+
|
|
65
|
+
ARGUMENTS
|
|
66
|
+
[SHELL] (zsh|bash|powershell) Shell type
|
|
67
|
+
|
|
68
|
+
FLAGS
|
|
69
|
+
-r, --refresh-cache Refresh cache (ignores displaying instructions)
|
|
70
|
+
|
|
71
|
+
DESCRIPTION
|
|
72
|
+
Display autocomplete installation instructions.
|
|
73
|
+
|
|
74
|
+
EXAMPLES
|
|
75
|
+
$ tm autocomplete
|
|
76
|
+
|
|
77
|
+
$ tm autocomplete bash
|
|
78
|
+
|
|
79
|
+
$ tm autocomplete zsh
|
|
80
|
+
|
|
81
|
+
$ tm autocomplete powershell
|
|
82
|
+
|
|
83
|
+
$ tm autocomplete --refresh-cache
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.40/src/commands/autocomplete/index.ts)_
|
|
87
|
+
|
|
88
|
+
## `tm help [COMMAND]`
|
|
89
|
+
|
|
90
|
+
Display help for tm.
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
USAGE
|
|
94
|
+
$ tm help [COMMAND...] [-n]
|
|
95
|
+
|
|
96
|
+
ARGUMENTS
|
|
97
|
+
[COMMAND...] Command to show help for.
|
|
98
|
+
|
|
99
|
+
FLAGS
|
|
100
|
+
-n, --nested-commands Include all nested commands in the output.
|
|
101
|
+
|
|
102
|
+
DESCRIPTION
|
|
103
|
+
Display help for tm.
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.37/src/commands/help.ts)_
|
|
107
|
+
|
|
108
|
+
## `tm scripts add PATH`
|
|
109
|
+
|
|
110
|
+
添加脚本到用户配置目录
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
USAGE
|
|
114
|
+
$ tm scripts add PATH
|
|
115
|
+
|
|
116
|
+
ARGUMENTS
|
|
117
|
+
PATH 脚本文件路径
|
|
118
|
+
|
|
119
|
+
DESCRIPTION
|
|
120
|
+
添加脚本到用户配置目录
|
|
121
|
+
|
|
122
|
+
EXAMPLES
|
|
123
|
+
$ tm scripts add ./script.ps1
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
_See code: [src/commands/scripts/add.ts](https://github.com/lipanpan-hub/taskmgr/blob/v0.0.0/src/commands/scripts/add.ts)_
|
|
127
|
+
|
|
128
|
+
## `tm scripts list`
|
|
129
|
+
|
|
130
|
+
列出用户配置目录下的所有脚本
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
USAGE
|
|
134
|
+
$ tm scripts list
|
|
135
|
+
|
|
136
|
+
DESCRIPTION
|
|
137
|
+
列出用户配置目录下的所有脚本
|
|
138
|
+
|
|
139
|
+
EXAMPLES
|
|
140
|
+
$ tm scripts list
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
_See code: [src/commands/scripts/list.ts](https://github.com/lipanpan-hub/taskmgr/blob/v0.0.0/src/commands/scripts/list.ts)_
|
|
144
|
+
|
|
145
|
+
## `tm scripts open`
|
|
146
|
+
|
|
147
|
+
打开脚本文件目录
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
USAGE
|
|
151
|
+
$ tm scripts open
|
|
152
|
+
|
|
153
|
+
DESCRIPTION
|
|
154
|
+
打开脚本文件目录
|
|
155
|
+
|
|
156
|
+
EXAMPLES
|
|
157
|
+
$ tm scripts open
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
_See code: [src/commands/scripts/open.ts](https://github.com/lipanpan-hub/taskmgr/blob/v0.0.0/src/commands/scripts/open.ts)_
|
|
161
|
+
|
|
162
|
+
## `tm tsk add TASKNAME`
|
|
163
|
+
|
|
164
|
+
创建定时任务
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
USAGE
|
|
168
|
+
$ tm tsk add TASKNAME --path <value> [--arguments <value>] [--description <value>] [--hidden]
|
|
169
|
+
[--start-when-available] [--stop-on-battery] [--time <value>] [--trigger boot|daily|logon|monthly|once|weekly]
|
|
170
|
+
[--wake]
|
|
171
|
+
|
|
172
|
+
ARGUMENTS
|
|
173
|
+
TASKNAME 任务名称
|
|
174
|
+
|
|
175
|
+
FLAGS
|
|
176
|
+
--arguments=<value> 执行参数
|
|
177
|
+
--description=<value> 任务描述
|
|
178
|
+
--hidden 是否隐藏任务
|
|
179
|
+
--path=<value> (required) 可执行文件路径
|
|
180
|
+
--start-when-available 错过启动时间后是否自动启动
|
|
181
|
+
--stop-on-battery 使用电池供电时是否停止任务
|
|
182
|
+
--time=<value> [default: 09:00] 任务开始时间 (HH:mm)
|
|
183
|
+
--trigger=<option> [default: daily] 触发类型: daily, weekly, monthly, once, boot, logon
|
|
184
|
+
<options: boot|daily|logon|monthly|once|weekly>
|
|
185
|
+
--wake 是否唤醒计算机运行任务
|
|
186
|
+
|
|
187
|
+
DESCRIPTION
|
|
188
|
+
创建定时任务
|
|
189
|
+
|
|
190
|
+
EXAMPLES
|
|
191
|
+
$ tm tsk add myTask --path "C:\app.exe" --trigger daily --time "09:00"
|
|
192
|
+
|
|
193
|
+
$ tm tsk add backupTask --path "C:\backup.exe" --arguments "--full --dest D:\backup"
|
|
194
|
+
|
|
195
|
+
$ tm tsk add reportTask --path "C:\report.exe" --arguments '-f json -o "output.txt"' --trigger weekly
|
|
196
|
+
|
|
197
|
+
$ tm tsk add psTask --path "powershell.exe" --arguments '-ExecutionPolicy Bypass -File "C:\scripts\cleanup.ps1"' --trigger daily
|
|
198
|
+
|
|
199
|
+
$ tm tsk add psInlineTask --path "powershell.exe" --arguments '-Command "Get-ChildItem C:\temp | Remove-Item -Recurse -Force"' --trigger weekly
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
_See code: [src/commands/tsk/add.ts](https://github.com/lipanpan-hub/taskmgr/blob/v0.0.0/src/commands/tsk/add.ts)_
|
|
203
|
+
|
|
204
|
+
## `tm tsk del TASKNAME`
|
|
205
|
+
|
|
206
|
+
删除定时任务
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
USAGE
|
|
210
|
+
$ tm tsk del TASKNAME
|
|
211
|
+
|
|
212
|
+
ARGUMENTS
|
|
213
|
+
TASKNAME 任务名称
|
|
214
|
+
|
|
215
|
+
DESCRIPTION
|
|
216
|
+
删除定时任务
|
|
217
|
+
|
|
218
|
+
EXAMPLES
|
|
219
|
+
$ tm tsk del myTask
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
_See code: [src/commands/tsk/del.ts](https://github.com/lipanpan-hub/taskmgr/blob/v0.0.0/src/commands/tsk/del.ts)_
|
|
223
|
+
|
|
224
|
+
## `tm tsk list`
|
|
225
|
+
|
|
226
|
+
列出所有定时任务
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
USAGE
|
|
230
|
+
$ tm tsk list [--multi]
|
|
231
|
+
|
|
232
|
+
FLAGS
|
|
233
|
+
--multi 使用多行格式显示任务详情
|
|
234
|
+
|
|
235
|
+
DESCRIPTION
|
|
236
|
+
列出所有定时任务
|
|
237
|
+
|
|
238
|
+
EXAMPLES
|
|
239
|
+
$ tm tsk list
|
|
240
|
+
|
|
241
|
+
$ tm tsk list --multi
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
_See code: [src/commands/tsk/list.ts](https://github.com/lipanpan-hub/taskmgr/blob/v0.0.0/src/commands/tsk/list.ts)_
|
|
245
|
+
|
|
246
|
+
## `tm version`
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
USAGE
|
|
250
|
+
$ tm version [--json] [--verbose]
|
|
251
|
+
|
|
252
|
+
FLAGS
|
|
253
|
+
--verbose Show additional information about the CLI.
|
|
254
|
+
|
|
255
|
+
GLOBAL FLAGS
|
|
256
|
+
--json Format output as json.
|
|
257
|
+
|
|
258
|
+
FLAG DESCRIPTIONS
|
|
259
|
+
--verbose Show additional information about the CLI.
|
|
260
|
+
|
|
261
|
+
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/2.2.37/src/commands/version.ts)_
|
|
265
|
+
<!-- commandsstop -->
|
|
266
|
+
* [`tm autocomplete [SHELL]`](#tm-autocomplete-shell)
|
|
267
|
+
* [`tm help [COMMAND]`](#tm-help-command)
|
|
268
|
+
* [`tm version`](#tm-version)
|
|
269
|
+
|
|
270
|
+
## `tm autocomplete [SHELL]`
|
|
271
|
+
|
|
272
|
+
Display autocomplete installation instructions.
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
USAGE
|
|
276
|
+
$ tm autocomplete [SHELL] [-r]
|
|
277
|
+
|
|
278
|
+
ARGUMENTS
|
|
279
|
+
[SHELL] (zsh|bash|powershell) Shell type
|
|
280
|
+
|
|
281
|
+
FLAGS
|
|
282
|
+
-r, --refresh-cache Refresh cache (ignores displaying instructions)
|
|
283
|
+
|
|
284
|
+
DESCRIPTION
|
|
285
|
+
Display autocomplete installation instructions.
|
|
286
|
+
|
|
287
|
+
EXAMPLES
|
|
288
|
+
$ tm autocomplete
|
|
289
|
+
|
|
290
|
+
$ tm autocomplete bash
|
|
291
|
+
|
|
292
|
+
$ tm autocomplete zsh
|
|
293
|
+
|
|
294
|
+
$ tm autocomplete powershell
|
|
295
|
+
|
|
296
|
+
$ tm autocomplete --refresh-cache
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.40/src/commands/autocomplete/index.ts)_
|
|
300
|
+
|
|
301
|
+
## `tm help [COMMAND]`
|
|
302
|
+
|
|
303
|
+
Display help for tm.
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
USAGE
|
|
307
|
+
$ tm help [COMMAND...] [-n]
|
|
308
|
+
|
|
309
|
+
ARGUMENTS
|
|
310
|
+
[COMMAND...] Command to show help for.
|
|
311
|
+
|
|
312
|
+
FLAGS
|
|
313
|
+
-n, --nested-commands Include all nested commands in the output.
|
|
314
|
+
|
|
315
|
+
DESCRIPTION
|
|
316
|
+
Display help for tm.
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.37/src/commands/help.ts)_
|
|
320
|
+
|
|
321
|
+
## `tm version`
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
USAGE
|
|
325
|
+
$ tm version [--json] [--verbose]
|
|
326
|
+
|
|
327
|
+
FLAGS
|
|
328
|
+
--verbose Show additional information about the CLI.
|
|
329
|
+
|
|
330
|
+
GLOBAL FLAGS
|
|
331
|
+
--json Format output as json.
|
|
332
|
+
|
|
333
|
+
FLAG DESCRIPTIONS
|
|
334
|
+
--verbose Show additional information about the CLI.
|
|
335
|
+
|
|
336
|
+
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/2.2.37/src/commands/version.ts)_
|
|
340
|
+
<!-- commandsstop -->
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
## About
|
|
2
|
+
The original and most popular .NET wrapper for the [Windows Task Scheduler](https://docs.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page). It provides functionally complete classes that cover all development aspects related to system tasks.
|
|
3
|
+
|
|
4
|
+
More information can be found on the [project page on GitHub](https://github.com/dahall/taskscheduler).
|
|
5
|
+
|
|
6
|
+
## Support
|
|
7
|
+
Below are links to sites that provide in-depth examples, documentation and discussions. Please go here first with your questions as the community has been active for over a decade.
|
|
8
|
+
* [Wiki](https://github.com/dahall/TaskScheduler/wiki) - Sample code, library how-to, troubleshooting, etc.
|
|
9
|
+
* [API documentation](https://dahall.github.io/TaskScheduler) - Class/method/property documentation and examples
|
|
10
|
+
* [Full Issues Log](https://github.com/dahall/TaskScheduler/issues?q=) - Use the search box to see if your question may already be answered.
|
|
11
|
+
* [Discussion Forum](https://github.com/dahall/TaskScheduler/discussions) - Users helping users, enhancement requests, Q&A (retired Google forum [here](https://groups.google.com/forum/#!forum/taskscheduler))
|
|
12
|
+
* [Troubleshooting Tool](https://github.com/dahall/TaskSchedulerConfig) - Tool to help identify and fix configuration and connectivity issues. (ClickOnce installer [here](https://github.com/dahall/TaskSchedulerConfig/blob/master/publish/setup.exe?raw=true))
|
|
13
|
+
|
|
14
|
+
## Key Features
|
|
15
|
+
Microsoft introduced version 2.0 (internally version 1.2) with a completely new object model with Windows Vista. The managed assembly closely resembles the new object model but allows the 1.0 (internally version 1.1) COM objects to be manipulated. It will automatically choose the most recent version of the library found on the host system (up through 1.4). Core features include:
|
|
16
|
+
|
|
17
|
+
* Separate, functionally identical, libraries for .NET 2.0, 3.5, 4.0, 4.52, 5.0, 6.0, .NET Standard 2.0, .NET Core 2.0, 2.1, 3.0, 3.1.
|
|
18
|
+
* Unlike the base COM libraries, this wrapper accommodates creating and viewing tasks up and down stream.
|
|
19
|
+
* Supports all V2 native properties, even under V1 tasks.
|
|
20
|
+
* Maintain EmailAction and ShowMessageAction using PowerShell scripts for systems after Win8 where these actions have been deprecated.
|
|
21
|
+
* Supports all action types (not just ExecAction) on V1 systems (XP/WS2003) and earlier (if PowerShell is installed).
|
|
22
|
+
* Supports multiple actions on V1 systems (XP/WS2003). Native library only supports a single action.
|
|
23
|
+
* Supports serialization to XML for both 1.0 and 2.0 tasks (base library only supports 2.0)
|
|
24
|
+
* Supports task validation for targeted version.
|
|
25
|
+
* Supports secure task reading and maintenance.
|
|
26
|
+
* Fluent methods for task creation.
|
|
27
|
+
* Cron syntax for trigger creation.
|
|
28
|
+
|
|
29
|
+
The currently supported localizations include: English, Spanish, Italian, French, Chinese (Simplified), German, Polish and Russian.
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
You can perform several actions in a single line of code:
|
|
33
|
+
```C#
|
|
34
|
+
// Run a program every day on the local machine
|
|
35
|
+
TaskService.Instance.AddTask("Test", QuickTriggerType.Daily, "myprogram.exe", "-a arg");
|
|
36
|
+
|
|
37
|
+
// Run a custom COM handler on the last day of every month
|
|
38
|
+
TaskService.Instance.AddTask("Test", new MonthlyTrigger { RunOnLastDayOfMonth = true },
|
|
39
|
+
new ComHandlerAction(new Guid("{CE7D4428-8A77-4c5d-8A13-5CAB5D1EC734}")));
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For many more options, use the library classes to build a complex task. Below is a brief example of how to use the library from C#.
|
|
43
|
+
```C#
|
|
44
|
+
using System;
|
|
45
|
+
using Microsoft.Win32.TaskScheduler;
|
|
46
|
+
|
|
47
|
+
class Program
|
|
48
|
+
{
|
|
49
|
+
static void Main()
|
|
50
|
+
{
|
|
51
|
+
// Get the service on the remote machine
|
|
52
|
+
using (TaskService ts = new TaskService(@"\\RemoteServer", "username", "domain", "password"))
|
|
53
|
+
{
|
|
54
|
+
// Create a new task definition and assign properties
|
|
55
|
+
TaskDefinition td = ts.NewTask();
|
|
56
|
+
td.RegistrationInfo.Description = "Does something";
|
|
57
|
+
|
|
58
|
+
// Create a trigger that will fire the task at this time every other day
|
|
59
|
+
td.Triggers.Add(new DailyTrigger { DaysInterval = 2 });
|
|
60
|
+
|
|
61
|
+
// Create an action that will launch Notepad whenever the trigger fires
|
|
62
|
+
td.Actions.Add(new ExecAction("notepad.exe", "c:\\test.log", null));
|
|
63
|
+
|
|
64
|
+
// Register the task in the root folder.
|
|
65
|
+
// (Use the username here to ensure remote registration works.)
|
|
66
|
+
ts.RootFolder.RegisterTaskDefinition(@"Test", td, TaskCreation.CreateOrUpdate, "username");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For extended examples on how to the use the library, look at the [Examples Page](https://github.com/dahall/TaskScheduler/wiki/Examples).
|
|
Binary file
|