Schedule Functions The schedule service functions are used to submit and manage jobs to be executed at a specifed computer at a specified time (or times) in the future. Jobs can be commands and programs. Jobs can be managed at remote and local computers, provided schedule service is running at a specified computer. The schedule service functions are:NetScheduleJobAdd NetScheduleJobDel NetScheduleJobEnum NetScheduleJobGetInfo Schedule service functions are also known as "Job" and "AT command" functions.Schedule service functions are job submittal (NetScheduleJobAdd), job cancellation (NetScheduleJobDel), job enumeration (NetScheduleJobEnum) and retrieving information about a particular job (NetScheduleJobGetInfo). In order for these functions to succeed, a caller must have administrator's privilege at a computer where Schedule service is running.Structures The AT_INFO structure is used by NetScheduleJobAdd to specify a job to be added, and by NetScheduleJobGetInfo to return information about an already submitted job. The AT_ENUM structure is used by NetScheduleJobEnum to enumerate and return information about an entire queue of already submitted jobs.
我问的不是NetScheduleJobAdd这些API啊,这些可设置的选项很少.
谢谢楼上有两位给的答案,这两个也是在网上比较容易找到一些的,但不适合我需要啊. 毕竟我这个不是.net为主的项目,.net的方式肯定不是首先.后来搜到这位高人给出的VC6的例子,下载后测试通过,但悲哀地发现: 这个由C:\WINDOWS\system32\mstask.dll提供的接口,我竟然不知道能否在VB6中直接使用,怎么使用: ITask\=>IScheduledWorkItem=>IUnknown 直接引用肯定是不行的:http://www.codeproject.com/kb/shell/cscheduledtask.aspx Basic class for using the Microsoft Task Scheduler Mike was a VC MVP from 2005 to 2009. Occupation: Software Developer (Senior) Company: VMware
晕哦,那不知微软自己的schtasks.exe是怎么实现这些功能的哦:)
The schedule service functions are used to submit and manage jobs to be executed at a specifed computer at a specified time (or times) in the future. Jobs can be commands and programs. Jobs can be managed at remote and local computers, provided schedule service is running at a specified computer. The schedule service functions are:NetScheduleJobAdd
NetScheduleJobDel
NetScheduleJobEnum
NetScheduleJobGetInfo Schedule service functions are also known as "Job" and "AT command" functions.Schedule service functions are job submittal (NetScheduleJobAdd), job cancellation (NetScheduleJobDel), job enumeration (NetScheduleJobEnum) and retrieving information about a particular job (NetScheduleJobGetInfo). In order for these functions to succeed, a caller must have administrator's privilege at a computer where Schedule service is running.Structures
The AT_INFO structure is used by NetScheduleJobAdd to specify a job to be added, and by NetScheduleJobGetInfo to return information about an already submitted job. The AT_ENUM structure is used by NetScheduleJobEnum to enumerate and return information about an entire queue of already submitted jobs.
毕竟我这个不是.net为主的项目,.net的方式肯定不是首先.后来搜到这位高人给出的VC6的例子,下载后测试通过,但悲哀地发现:
这个由C:\WINDOWS\system32\mstask.dll提供的接口,我竟然不知道能否在VB6中直接使用,怎么使用:
ITask\=>IScheduledWorkItem=>IUnknown
直接引用肯定是不行的:http://www.codeproject.com/kb/shell/cscheduledtask.aspx
Basic class for using the Microsoft Task Scheduler
Mike was a VC MVP from 2005 to 2009.
Occupation: Software Developer (Senior)
Company: VMware
Shell "cmd.exe /c %SystemRoot%\explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{D6277990-4C6A-11CF-8D87-00AA0060F5BF} "
End Sub不过此时我想到一个安全问题,有经验的人不妨指点一下:
就是,打开Task Scheduler服务后,默认从网络上好像是可用at命令远程在自己机器上创建服务的是吧.这会不会给从网络上攻击的人提供方便之门.当然,我知at远程创建任务是要用户名密码的,可毕竟现在很多机器上是不设口令,或口令容易猜的啊.
我从两个方面考虑的:
一,要测试一下没设口令的机器能否用at远程创建任务
二,看看怎么设置,使得只允许本机的程序操作任务,不让网络上的程序来尝试枚举密码什么的.