|
hackhd
中级用户
  
积分 231
发帖 102
注册 2008-1-25
状态 离线
|
『楼 主』:
[已解决]用VBS获取系统当前时间添加at任务
使用 LLM 解释/回答一下
比如说现在一个VBS脚本运行起来在退出这个脚本前(因为前面有do loop语句所以运行后不会自动退出)
获取当前系统时间。只要分钟就好了 ,然后在获得的当前时间上+个5分钟,再运行这个VBS脚本
简单点说就像
at 系统当前时间(分钟)+5(分钟) xx.vbs
wscript.quit
Last edited by hackhd on 2008-1-27 at 07:24 PM ]
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 ]
|
|
2008-1-26 06:04 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
|
2008-1-26 12:28 |
|
|
hackhd
中级用户
  
积分 231
发帖 102
注册 2008-1-25
状态 离线
|
|
2008-1-26 18:37 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
Times = Time
NewTime = Split(times, ":" ,-1)
Wscript.echo NewTime(1)+5
'完整写法
Wscript.echo Time & "====加5分钟是====" & NewTime(0) & chr(58) & NewTime(1)+5 & chr(58) & NewTime(2)
```
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)
```
|

第一高手 第二高手
我的小站
 |
|
2008-1-26 19:07 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
|
2008-1-26 19:30 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
貌似没有做55处理……
It seems that the 55 processing was not done...
|
|
2008-1-26 19:31 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
是的其实首句是多余的,没做55+处理,我怕数字计算
NewTime = Split(time, ":" ,-1)
Wscript.echo NewTime(1)+5
Wscript.echo Time & "====加5分钟是====" & NewTime(0) & chr(58) & NewTime(1)+5 & chr(58) & NewTime(2)
Yes, in fact, the first sentence is redundant and not processed for 55+. I was afraid of numerical calculations
NewTime = Split(time, ":" ,-1)
Wscript.echo NewTime(1)+5
Wscript.echo Time & "====加5 minutes is====" & NewTime(0) & chr(58) & NewTime(1)+5 & chr(58) & NewTime(2)
|

第一高手 第二高手
我的小站
 |
|
2008-1-26 19:57 |
|
|
hackhd
中级用户
  
积分 231
发帖 102
注册 2008-1-25
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
获取时间方法4楼说得很清楚了。谢谢啊。我把它整合起来添加一个DOS任务怎么就出错呢。
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)
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)
|
|
2008-1-26 19:58 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
你msgbox下你的command就知道你自己错哪里了
Then msgbox your command and you'll know where you're wrong.
|
|
2008-1-26 20:03 |
|
|
hackhd
中级用户
  
积分 231
发帖 102
注册 2008-1-25
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
现在这样子已经以提示了command这行类型不匹配了
后面加msgbox没用。我是个菜菜还烦大哥再指点指点
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.
|
|
2008-1-26 20:12 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
command = "at " & NewTime & "(1)+5 " & "1.vbs"
你照4楼的修改……
NewTime是个数组……
不能单独,你的括号引用错误了。。。
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...
|
|
2008-1-26 20:22 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
整点55分钟+5 及12点+1=01完整代码
NewTime = Split(Time, ":" ,-1)
if NewTime(1)+5 > 59 Then
mm=NewTime(1)+5-60
Newnn=Split(NewTime(0), " " ,-1)
if Newnn(1)+1 = 13 Then
nn="01"
else
nn=Newnn(1)+1
end if
Times = Newnn(0) & " " & nn & chr(58) & mm & chr(58) & NewTime(2)
else
Times = NewTime(0) & chr(58) & NewTime(1)+5 & chr(58) & NewTime(2)
end if
Wscript.echo Time & "====加5分钟是====" & Times
Here is the translation:
NewTime = Split(Time, ":", -1)
If NewTime(1) + 5 > 59 Then
mm = NewTime(1) + 5 - 60
Newnn = Split(NewTime(0), " ", -1)
If Newnn(1) + 1 = 13 Then
nn = "01"
Else
nn = Newnn(1) + 1
End If
Times = Newnn(0) & " " & nn & Chr(58) & mm & Chr(58) & NewTime(2)
Else
Times = NewTime(0) & ":" & NewTime(1) + 5 & ":" & NewTime(2)
End If
Wscript.Echo Time & "====Add 5 minutes is====" & Times
|

第一高手 第二高手
我的小站
 |
|
2008-1-26 21:04 |
|
|
hackhd
中级用户
  
积分 231
发帖 102
注册 2008-1-25
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
哇。这么多代码。要是写个病毒怎么办。一个功能就占了这么多了。
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 ]
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 ]
|
|
2008-1-26 21:23 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
Newnn = Split(NewTime(0), " " , - 1) '不清楚用意
'将time Split就得到时分秒了啊……
你那样貌似下标会越界……
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...
|
|
2008-1-26 21:32 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
Originally posted by hackhd at 2008-1-26 21:23:
哇。这么多代码。要是写个病毒怎么办。一个功能就占了这么多了。
a=Wsh.Run("at "&hour(now)&":"&(minute(now)+5)&" 1.vbs",0,False)
不是由长短绝对代码的好坏的……
你的这个觉得好麽?
12:56:36你的结果如何呢?而且at这样用是没有效果的吧
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.
|
|
2008-1-26 21:34 |
|