用VBS自定义时间新建计划任务
答案:1 悬赏:60 手机版
解决时间 2021-02-03 11:33
- 提问者网友:记得曾经
- 2021-02-02 17:24
http://www.microsoft.com/china/technet/community/scriptcenter/schedule/scrsch04.mspx网址如上,现在想问如何可以让用户自定义任务执行时间,比如说用inputbox补充一下,不要用at
最佳答案
- 五星知识达人网友:千夜
- 2021-02-02 18:13
input = inputbox("请输入执行时间,格式为HHMMSS")
eTime = "********" & input & ".000000-420"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create _
("Notepad.exe", eTime,_
True , 4, , True, JobId)
If errJobCreated <> 0 Then
Wscript.Echo "创建任务失败!"
Else
Wscript.Echo "任务创建成功!"
End If
有问题再沟通!
eTime = "********" & input & ".000000-420"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create _
("Notepad.exe", eTime,_
True , 4, , True, JobId)
If errJobCreated <> 0 Then
Wscript.Echo "创建任务失败!"
Else
Wscript.Echo "任务创建成功!"
End If
有问题再沟通!
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯