我想用 VBScript 编写创建计划任务的脚本。
我需要使用任务计划程序对象的枚举类型将任务设置为以“最高权限”运行。
有人知道我是怎么设置的吗?
谢谢,
本
我想用 VBScript 编写创建计划任务的脚本。
我需要使用任务计划程序对象的枚举类型将任务设置为以“最高权限”运行。
有人知道我是怎么设置的吗?
谢谢,
本
I guess you're using the Task Scheduler 2.0 Scripting API, right?
The easiest solution is to manually define any constants needed in your script:
Const TASK_RUNLEVEL_LUA = 0
Const TASK_RUNLEVEL_HIGHEST = 1
Alternatively, you can try the following: wrap your VBScript code in a Windows Script (.wsf) file and use the <reference>
tag to import the Task Scheduler type library, so that your script has access to constants defined in that type library. Your .wsf script would look something like this:
<job>
<reference object="Schedule.Service" />
<script language="VBScript">
WScript.Echo TASK_RUNLEVEL_HIGHEST
</script>
</job>
You can find more info on Windows script files here: Using Windows Script Files (.wsf).