中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-07 09:24
48,040 topics / 350,125 posts / today 0 new / 48,252 members
DOS批处理 & 脚本技术(批处理室) » [Solved] Get the current system time with VBS and add an at task
Printable Version  2,861 / 27
Floor1 hackhd Posted 2008-01-26 06:04
中级用户 Posts 102 Credits 231
For example, now a VBS script runs. Before exiting this script (because there is a do loop statement before, so it will not exit automatically after running). Get the current system time. Just get the minutes. Then add 5 minutes to the obtained current time, and then run this VBS script. Simply put, it is like at the current system time (minutes) +5 (minutes) xx.vbs wscript.quit

[ Last edited by hackhd on 2008-1-27 at 07:24 PM ]
Floor2 slore Posted 2008-01-26 12:28
铂金会员 Posts 2,478 Credits 5,212
msgbox time自己mid吧
Floor3 hackhd Posted 2008-01-26 18:37
中级用户 Posts 102 Credits 231
Floor4 fastslz Posted 2008-01-26 19:07
铂金会员 Posts 2,315 Credits 5,493 From 上海
```
Times = Time
NewTime = Split(times, ":", -1)
Wscript.echo NewTime(1) + 5
'Full writing
Wscript.echo Time & "====Add 5 minutes is====" & NewTime(0) & chr(58) & NewTime(1) + 5 & chr(58) & NewTime(2)
```
Floor5 slore Posted 2008-01-26 19:30
铂金会员 Posts 2,478 Credits 5,212
The last sentence above is Times
Floor6 slore Posted 2008-01-26 19:31
铂金会员 Posts 2,478 Credits 5,212
It seems that the 55 processing was not done...
Floor7 fastslz Posted 2008-01-26 19:57
铂金会员 Posts 2,315 Credits 5,493 From 上海
Yes, in fact, the first sentence is redundant and not processed for 55+. I was afraid of numerical calculations
Floor8 hackhd Posted 2008-01-26 19:58
中级用户 Posts 102 Credits 231
The method of getting time is clearly stated on the 4th floor. Thanks. But why do I get an error when I integrate it and add a DOS task.
dim wsh
set wsh=createobject("wscript.shell")
set fso=createobject("scripting.filesystemobject")
Times = Time
NewTime = Split(times, ":" ,-1)
command="at "&NewTime&"(1)+5 "&"1.vbs"
retodate=wsh.Run(command,0,true)
Floor9 slore Posted 2008-01-26 20:03
铂金会员 Posts 2,478 Credits 5,212
Then msgbox your command and you'll know where you're wrong.
Floor10 hackhd Posted 2008-01-26 20:12
中级用户 Posts 102 Credits 231
Now it has prompted that the type of the command line does not match. Adding msgbox later doesn't work. I'm a newbie, and I'm bothering the elder brother to give more guidance.
Floor11 slore Posted 2008-01-26 20:22
铂金会员 Posts 2,478 Credits 5,212
command = "at " & NewTime & "(1)+5 " & "1.vbs"

You follow the modification of floor 4...

NewTime is an array...

Cannot be single, your parenthesis reference is wrong...
Floor12 fastslz Posted 2008-01-26 21:04
铂金会员 Posts 2,315 Credits 5,493 From 上海
Here is the translation:

Floor13 hackhd Posted 2008-01-26 21:23
中级用户 Posts 102 Credits 231
Wow. So much code. What if it's a virus? Just one function takes up so much.

a=Wsh.Run("at " & hour(now) & ":" & ((minute(now)+5) mod 60) & " 1.vbs",0,False)

[ Last edited by hackhd on 2008-1-26 at 09:41 PM ]
Floor14 slore Posted 2008-01-26 21:32
铂金会员 Posts 2,478 Credits 5,212
Newnn = Split(NewTime(0), " " ,-1) 'I don't know the intention

'Splitting time gets hours, minutes and seconds...

What you did above seems to have subscript out of bounds...
Floor15 slore Posted 2008-01-26 21:34
铂金会员 Posts 2,478 Credits 5,212
Originally posted by hackhd at 2008-1-26 21:23:
Wow. So much code. What if it's a virus? Just one function takes up so much.

a=Wsh.Run("at "&hour(now)&":"&(minute(now)+5)&" 1.vbs",0,False)


It's not about the length to determine the quality of code absolutely...

Do you think this one is good?

What's your result at 12:56:36? And using at like this may not work.
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023